From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id D97B0A1396 for ; Wed, 14 Jun 2023 12:43:58 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id B85D51AB06 for ; Wed, 14 Jun 2023 12:43:28 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Wed, 14 Jun 2023 12:43:28 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id CCC6E45560 for ; Wed, 14 Jun 2023 12:43:27 +0200 (CEST) From: Stoiko Ivanov To: pve-devel@lists.proxmox.com Date: Wed, 14 Jun 2023 12:43:15 +0200 Message-Id: <20230614104316.3250821-2-s.ivanov@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230614104316.3250821-1-s.ivanov@proxmox.com> References: <20230614104316.3250821-1-s.ivanov@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.101 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - Subject: [pve-devel] [PATCH container 1/2] tests: fix small syntax glitch X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jun 2023 10:43:58 -0000 adaptation to adhere to perlcritics recommendation led to the snapshot tests to not work anymore: ``` Undefined subroutine &Test::MockModule called at snapshot-test.pm line 300. ``` With this the snapshot tests still run and perlcritic seems happy Fixes: f505de300431134b202ad5a88f55721cb95e6fe4 Signed-off-by: Stoiko Ivanov --- src/test/snapshot-test.pm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/test/snapshot-test.pm b/src/test/snapshot-test.pm index 8e6e9c2..f9b1616 100644 --- a/src/test/snapshot-test.pm +++ b/src/test/snapshot-test.pm @@ -297,21 +297,21 @@ PVE::Tools::run_command("cp -a snapshot-input snapshot-working"); printf("\n"); printf("Setting up Mocking for PVE::LXC and PVE::LXC::Config\n"); -my $lxc_module = Test::MockModule('PVE::LXC')->new(); +my $lxc_module = Test::MockModule->new('PVE::LXC'); $lxc_module->mock('sync_container_namespace', sub { return; }); $lxc_module->mock('check_running', \&mocked_check_running); $lxc_module->mock('vm_stop', \&mocked_vm_stop); $lxc_module->mock('freeze', \&mocked_freeze); $lxc_module->mock('thaw', \&mocked_freeze); # re-use, as for now we don't care -my $lxc_config_module = Test::MockModule('PVE::LXC::Config')->new(); +my $lxc_config_module = Test::MockModule->new('PVE::LXC::Config'); $lxc_config_module->mock('config_file_lock', sub { return "snapshot-working/pve-test.lock"; }); $lxc_config_module->mock('cfs_config_path', \&mocked_cfs_config_path); $lxc_config_module->mock('load_config', \&mocked_load_config); $lxc_config_module->mock('write_config', \&mocked_write_config); $lxc_config_module->mock('has_feature', \&mocked_has_feature); -my $pve_cluster_module = Test::MockModule('PVE::Cluster')->new(); +my $pve_cluster_module = Test::MockModule->new('PVE::Cluster'); sub mocked_get_config { my ($path) = @_; return PVE::Tools::file_get_contents("snapshot-working/$path"); @@ -319,7 +319,7 @@ sub mocked_get_config { $pve_cluster_module->mock('get_config', \&mocked_get_config); # ignore existing replication config -my $repl_config_module = Test::MockModule('PVE::ReplicationConfig')->new(); +my $repl_config_module = Test::MockModule->new('PVE::ReplicationConfig'); $repl_config_module->mock('check_for_existing_jobs' => sub { return undef }); $running = 1; @@ -399,7 +399,7 @@ $vol_snapshot_rollback_possible->{"local:snapshotable-disk-4"} = 1; printf("\n"); printf("Setting up Mocking for PVE::Storage\n"); -my $storage_module = Test::MockModule('PVE::Storage')->new(); +my $storage_module = Test::MockModule->new('PVE::Storage'); $storage_module->mock('activate_storage', \&mocked_activate_storage); $storage_module->mock('config', sub { return undef; }); $storage_module->mock('volume_snapshot', \&mocked_volume_snapshot); @@ -411,7 +411,7 @@ printf("\tconfig(), volume_snapshot(), volume_snapshot_delete(), volume_snapshot printf("\n"); printf("Setting up Mocking for PVE::Tools\n"); -my $tools_module = Test::MockModule('PVE::Tools')->new(); +my $tools_module = Test::MockModule->new('PVE::Tools'); $tools_module->mock('run_command' => \&mocked_run_command); printf("\trun_command() mocked\n"); -- 2.30.2