[pve-devel] [PATCH qemu-server] test: migrate: correctly mock storage module

Fabian Ebner f.ebner at proxmox.com
Mon Feb 8 15:26:03 CET 2021


by fixing a typo. Since cfs_read_file within the storage module was not mocked,
the tests could fail on some setups. Now that get_bandwidth_limit is mocked,
cfs_read_file is not called anymore, but still mock it too for good measure and
to make it more future-proof.

Reported-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
 test/MigrationTest/Shared.pm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/test/MigrationTest/Shared.pm b/test/MigrationTest/Shared.pm
index d7aeb36..6552465 100644
--- a/test/MigrationTest/Shared.pm
+++ b/test/MigrationTest/Shared.pm
@@ -140,9 +140,10 @@ $storage_module->mock(
     config => sub {
 	return $storage_config;
     },
-    get_bandwitdth_limit => sub {
+    get_bandwidth_limit => sub {
 	return 123456;
     },
+    cfs_read_file => $mocked_cfs_read_file,
 );
 
 our $storage_plugin_module = Test::MockModule->new("PVE::Storage::Plugin");
-- 
2.20.1





More information about the pve-devel mailing list