[pve-devel] [PATCH manager] tests: override GuestHelper's lockdir
Wolfgang Bumiller
w.bumiller at proxmox.com
Fri Jun 9 09:55:57 CEST 2017
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 | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/bin/test/ReplicationTestEnv.pm b/bin/test/ReplicationTestEnv.pm
index ce72fa9c..cdf81f05 100755
--- a/bin/test/ReplicationTestEnv.pm
+++ b/bin/test/ReplicationTestEnv.pm
@@ -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');
--
2.11.0
More information about the pve-devel
mailing list