]> git.proxmox.com Git - pve-manager.git/commitdiff
test: allow running replication tests in parallel
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 2 Dec 2020 17:00:44 +0000 (18:00 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 2 Dec 2020 17:00:47 +0000 (18:00 +0100)
running multiple workers reduces built time from >3s to ~0.6s here.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
test/Makefile
test/ReplicationTestEnv.pm

index 478d302f37893450f50cdf853f38c56b9b62c994..d383e89f8a198954cf1234261efe055cd1b91ba5 100644 (file)
@@ -10,13 +10,10 @@ check: test-replication test-balloon test-mail test-vzdump
 test-balloon:
        ./balloontest.pl
 
-test-replication:
-       ./replication_test1.pl
-       ./replication_test2.pl
-       ./replication_test3.pl
-       ./replication_test4.pl
-       ./replication_test5.pl
-       ./replication_test6.pl
+test-replication: replication1.t replication2.t replication3.t replication4.t replication5.t replication6.t
+
+replication%.t: replication_test%.pl
+       ./$<
 
 test-mail:
        ./mail_test.pl
index e92fba185d8246fee4ee640bfcc4b863adbed816..005e6d548f1fba33464e0486bd11778ae59fb495 100755 (executable)
@@ -68,13 +68,13 @@ my $mocked_ssh_info_to_command = sub {
     return ['fake_ssh', $info->{name}, @extra_options];
 };
 
-my $statefile = ".mocked_repl_state";
+my $statefile = ".mocked_repl_state.$$";
 
 unlink $statefile;
 $PVE::ReplicationState::state_path = $statefile;
-$PVE::ReplicationState::state_lock = ".mocked_repl_state_lock";
-$PVE::API2::Replication::pvesr_lock_path = ".mocked_pvesr_lock";
-$PVE::GuestHelpers::lockdir = ".mocked_pve-manager_lock";
+$PVE::ReplicationState::state_lock = ".mocked_repl_state_lock.$$";
+$PVE::API2::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