[pve-devel] [PATCH qemu-server 5/12] test: mock cifs-store

Daniel Herzig d.herzig at proxmox.com
Fri Oct 25 17:02:36 CEST 2024


Let cifs-store appear as online to a call from
PVE::Storage::activate_storage.

Signed-off-by: Daniel Herzig <d.herzig at proxmox.com>
---
 test/run_config2command_tests.pl | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/test/run_config2command_tests.pl b/test/run_config2command_tests.pl
index 2911483e..1a96c278 100755
--- a/test/run_config2command_tests.pl
+++ b/test/run_config2command_tests.pl
@@ -18,6 +18,7 @@ use PVE::QemuServer;
 use PVE::QemuServer::Monitor;
 use PVE::QemuServer::QMPHelpers;
 use PVE::QemuServer::CPUConfig;
+use PVE::Storage::CIFSPlugin;
 
 my $base_env = {
     storage_config => {
@@ -392,6 +393,18 @@ $pci_module->mock(
     }
 );
 
+my $pve_storage_cifsplugin_module = Test::MockModule->new("PVE::Storage::CIFSPlugin");
+$pve_storage_cifsplugin_module->mock(
+    check_connection => sub {
+	return 1;
+    },
+    cifs_is_mounted => sub {
+	my ($scfg, $mountdata) = @_;
+	my ($mountpoint, $server, $share) = $scfg->@{'path', 'server', 'share'};
+	return $mountpoint;
+    },
+);
+
 sub diff($$) {
     my ($a, $b) = @_;
     return if $a eq $b;
-- 
2.39.5





More information about the pve-devel mailing list