[pve-devel] [PATCH v2 manager 06/10] test: also mock cfs_read_file

Fabian Grünbichler f.gruenbichler at proxmox.com
Mon Nov 11 11:28:38 CET 2019


needed for tests to work without a functional running pmxcfs instance.

Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
 test/ReplicationTestEnv.pm | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/test/ReplicationTestEnv.pm b/test/ReplicationTestEnv.pm
index bc305627..f1eea688 100755
--- a/test/ReplicationTestEnv.pm
+++ b/test/ReplicationTestEnv.pm
@@ -229,6 +229,13 @@ my $mocked_cfs_lock_file = sub {
     return $res;
 };
 
+my $mocked_cfs_read_file = sub {
+    my ($filename) = @_;
+
+    return {} if $filename eq 'datacenter.cfg';
+    return PVE::Cluster::cfs_read_file($filename);
+};
+
 my $mocked_cfs_write_file = sub {
     my ($filename, $cfg) = @_;
 
@@ -267,6 +274,7 @@ sub setup {
 	cfs_update => sub {},
 	cfs_lock_file => $mocked_cfs_lock_file,
 	cfs_write_file => $mocked_cfs_write_file,
+	cfs_read_file => $mocked_cfs_read_file,
     );
     $pve_inotify_module->mock('nodename' => sub { return $mocked_nodename; });
 };
-- 
2.20.1





More information about the pve-devel mailing list