From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH container v2 1/2] tests: fix small syntax glitch
Date: Wed, 14 Jun 2023 14:33:24 +0200 [thread overview]
Message-ID: <20230614123325.4122277-2-s.ivanov@proxmox.com> (raw)
In-Reply-To: <20230614123325.4122277-1-s.ivanov@proxmox.com>
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 <s.ivanov@proxmox.com>
---
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
next prev parent reply other threads:[~2023-06-14 12:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-14 12:33 [pve-devel] [PATCH container v2 0/2] add test for LXC_NAME hosts entry and fix a minor glitch Stoiko Ivanov
2023-06-14 12:33 ` Stoiko Ivanov [this message]
2023-06-14 12:33 ` [pve-devel] [PATCH container v2 2/2] tests: add minimal test for LXC_NAME hosts entry Stoiko Ivanov
2023-06-14 14:25 ` [pve-devel] applied-series: [PATCH container v2 0/2] add test for LXC_NAME hosts entry and fix a minor glitch Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230614123325.4122277-2-s.ivanov@proxmox.com \
--to=s.ivanov@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox