5
0
mirror of git://git.proxmox.com/git/qemu-server.git synced 2024-12-23 17:34:19 +03:00

tests: mock storage locking for migration tests

by doing it in a local directory instead of /var/lock/pve-manager, which is
used by the installed/non-test PVE code. This also covers the shared case,
which will become relevant after fixing #3229 (currently migration doesn't
touch disks on shared storages).

Reported-by: Stefan Reiter <s.reiter@proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
This commit is contained in:
Fabian Ebner 2021-01-11 13:34:09 +01:00 committed by Thomas Lamprecht
parent 0a4aff09bd
commit c97a9c6ed8

View File

@ -145,6 +145,18 @@ $storage_module->mock(
}, },
); );
our $storage_plugin_module = Test::MockModule->new("PVE::Storage::Plugin");
$storage_plugin_module->mock(
cluster_lock_storage => sub {
my ($class, $storeid, $shared, $timeout, $func, @param) = @_;
mkdir "${RUN_DIR_PATH}/lock";
my $path = "${RUN_DIR_PATH}/lock/pve-storage-${storeid}";
return PVE::Tools::lock_file($path, $timeout, $func, @param);
},
);
our $systemd_module = Test::MockModule->new("PVE::Systemd"); our $systemd_module = Test::MockModule->new("PVE::Systemd");
$systemd_module->mock( $systemd_module->mock(
wait_for_unit_removed => sub { wait_for_unit_removed => sub {