]> git.proxmox.com Git - pve-manager.git/commitdiff
test: also mock cfs_read_file
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Mon, 11 Nov 2019 10:28:38 +0000 (11:28 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 18 Nov 2019 11:25:35 +0000 (12:25 +0100)
needed for tests to work without a functional running pmxcfs instance.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
test/ReplicationTestEnv.pm

index bc305627fd1a956ebb428b5d4cce43208e995e85..f1eea688d80357ca2ee3a6adc3fac3be18212ee3 100755 (executable)
@@ -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; });
 };