]> git.proxmox.com Git - pve-manager-legacy.git/commitdiff
tests: override GuestHelper's lockdir
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Fri, 9 Jun 2017 07:55:57 +0000 (09:55 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 9 Jun 2017 10:06:30 +0000 (12:06 +0200)
Otherwise the user running the tests may either create (and
end up being the ownderof) the system wide
/var/lock/pve-manager/* files, or the tests will fail (or
loop endlessly) if the user doesn't have access to them.

bin/test/ReplicationTestEnv.pm

index ce72fa9c3d01ff54cb4f93c91d83dd42435bcef5..cdf81f05ebc23b8956f2b27e6aabe6d1403b924f 100755 (executable)
@@ -64,6 +64,13 @@ unlink $statefile;
 $PVE::ReplicationState::state_path = $statefile;
 $PVE::ReplicationState::state_lock = ".mocked_repl_state_lock";
 $PVE::Replication::pvesr_lock_path = ".mocked_pvesr_lock";
+$PVE::GuestHelpers::lockdir = ".mocked_pve-manager_lock";
+
+if (!mkdir($PVE::GuestHelpers::lockdir) && !$!{EEXIST}) {
+    # If we cannot create the guest helper lockdir we'll loop endlessly, so die
+    # if it fails.
+    die "mkdir($PVE::GuestHelpers::lockdir): $!\n";
+}
 
 my $pve_cluster_module = Test::MockModule->new('PVE::Cluster');