[pve-devel] [PATCH qemu-server 1/6] test: unbreak restore_config_test
Fabian Grünbichler
f.gruenbichler at proxmox.com
Fri Jun 4 11:47:43 CEST 2021
for unprivileged users (and possibly some root setups). reading from
pmxcfs now results in a hard error for unprivileged users, so there
might be some more of these lurking somewhere..
Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
test/run_qemu_restore_config_tests.pl | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/test/run_qemu_restore_config_tests.pl b/test/run_qemu_restore_config_tests.pl
index e5d9f2a..dc10647 100755
--- a/test/run_qemu_restore_config_tests.pl
+++ b/test/run_qemu_restore_config_tests.pl
@@ -6,6 +6,7 @@ use warnings;
use lib qw(..);
use Test::More;
+use Test::MockModule;
use File::Basename;
@@ -18,6 +19,19 @@ my $EXPECTED_DIR = './restore-config-expected';
# 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) = @_;
--
2.30.2
More information about the pve-devel
mailing list