[pve-devel] [PATCH qemu-server 2/12] qemuserver: add helper function for mocking files
Daniel Herzig
d.herzig at proxmox.com
Fri Oct 25 17:02:33 CEST 2024
This stub function can be used for mocking a file's existance in testruns.
Signed-off-by: Daniel Herzig <d.herzig at proxmox.com>
---
This is just a method to allow for mocking a files (not) existance for testing,
as I did not find a way to mock '-e' itself -- ideas very welcome!
PVE/QemuServer.pm | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 0df3bda0..a45bdab9 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -8942,4 +8942,9 @@ sub delete_ifaces_ipams_ips {
}
}
+sub file_exists {
+ my $file_path = shift;
+ return -e $file_path
+}
+
1;
--
2.39.5
More information about the pve-devel
mailing list