]> git.proxmox.com Git - qemu-server.git/blobdiff - test/run_qemu_restore_config_tests.pl
bump version to 7.2-12
[qemu-server.git] / test / run_qemu_restore_config_tests.pl
index e5d9f2ab309bab7b29b450ca11327965e648c839..1e1e8072061d10b876fefc3c5081e9e4863dc920 100755 (executable)
@@ -5,7 +5,9 @@ use warnings;
 
 use lib qw(..);
 
+use Test::MockModule;
 use Test::More;
+use Test::MockModule;
 
 use File::Basename;
 
@@ -15,9 +17,29 @@ use PVE::Tools qw(dir_glob_foreach file_get_contents);
 my $INPUT_DIR = './restore-config-input';
 my $EXPECTED_DIR = './restore-config-expected';
 
+my $pve_cluster_module = Test::MockModule->new('PVE::Cluster');
+$pve_cluster_module->mock(
+    cfs_read_file => sub {
+       return {};
+    },
+);
+
 # NOTE update when you add/remove tests
 plan tests => 4;
 
+my $cfs_mock = Test::MockModule->new("PVE::Cluster");
+$cfs_mock->mock(
+    cfs_read_file => sub {
+       my ($file) = @_;
+
+       if ($file eq 'datacenter.cfg') {
+           return {};
+       } else {
+           die "'cfs_read_file' called - missing mock?\n";
+       }
+    },
+);
+
 dir_glob_foreach('./restore-config-input', '[0-9]+.conf', sub {
     my ($file) = @_;