tests: override GuestHelper's lockdir

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.
This commit is contained in:
Wolfgang Bumiller 2017-06-09 09:55:57 +02:00 committed by Dietmar Maurer
parent c7abca7e09
commit b1bfcfc30a

View File

@ -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');