From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id DCE886CFC0 for ; Thu, 12 Aug 2021 13:01:56 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id D3D5B22008 for ; Thu, 12 Aug 2021 13:01:26 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 5BDB121FCC for ; Thu, 12 Aug 2021 13:01:24 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id E042243319 for ; Thu, 12 Aug 2021 13:01:17 +0200 (CEST) From: Fabian Ebner To: pve-devel@lists.proxmox.com Date: Thu, 12 Aug 2021 13:01:02 +0200 Message-Id: <20210812110111.73883-4-f.ebner@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210812110111.73883-1-f.ebner@proxmox.com> References: <20210812110111.73883-1-f.ebner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.418 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH v3 storage 3/3] test: zfspool: extend some rollback is possible tests with new blockers parameter X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Aug 2021 11:01:56 -0000 and fix a few typos. Signed-off-by: Fabian Ebner --- test/run_test_zfspoolplugin.pl | 65 +++++++++++++++++++++++++--------- 1 file changed, 49 insertions(+), 16 deletions(-) diff --git a/test/run_test_zfspoolplugin.pl b/test/run_test_zfspoolplugin.pl index 2f63f1b..095ccb3 100755 --- a/test/run_test_zfspoolplugin.pl +++ b/test/run_test_zfspoolplugin.pl @@ -1362,10 +1362,21 @@ my $test6 = sub { eval { PVE::Storage::volume_snapshot($cfg, "$storagename:$vmdisk", 'snap1'); - if ( 1 != - PVE::Storage::volume_rollback_is_possible($cfg, "$storagename:$vmdisk", 'snap1')) { + + my $blockers = []; + my $res = PVE::Storage::volume_rollback_is_possible( + $cfg, + "$storagename:$vmdisk", + 'snap1', + $blockers, + ); + if ($res != 1) { + $count++; + warn "Test6 a: Rollback should be possible"; + } + if (scalar($blockers->@*) != 0) { $count++; - warn "Test6 a: Rollback sould possible" + warn "Test6 a: 'blockers' should be empty"; } }; if ($@) { @@ -1378,7 +1389,7 @@ my $test6 = sub { if ( 1 != PVE::Storage::volume_rollback_is_possible($cfg, "$storagename:$vmbase", 'snap1')) { $count++; - warn "Test6 b: Rollback sould possible" + warn "Test6 b: Rollback should be possible"; } }; if ($@) { @@ -1391,7 +1402,7 @@ my $test6 = sub { if ( 1 != PVE::Storage::volume_rollback_is_possible($cfg, "$storagename:$vmbase\/$vmlinked", 'snap1')) { $count++; - warn "Test6 c: Rollback sould possible" + warn "Test6 c: Rollback should be possible"; } }; if ($@) { @@ -1404,7 +1415,7 @@ my $test6 = sub { if ( 1 != PVE::Storage::volume_rollback_is_possible($cfg, "$storagename:$ctdisk", 'snap1')) { $count++; - warn "Test6 d: Rollback sould possible" + warn "Test6 d: Rollback should be possible"; } }; if ($@) { @@ -1417,7 +1428,7 @@ my $test6 = sub { if ( 1 != PVE::Storage::volume_rollback_is_possible($cfg, "$storagename:$ctbase", 'snap1')) { $count++; - warn "Test6 e: Rollback sould possible" + warn "Test6 e: Rollback should be possible"; } }; if ($@) { @@ -1430,7 +1441,7 @@ my $test6 = sub { if ( 1 != PVE::Storage::volume_rollback_is_possible($cfg, "$storagename:$ctbase\/$ctlinked", 'snap1')) { $count++; - warn "Test6 f: Rollback sould possible" + warn "Test6 f: Rollback should be possible"; } }; if ($@) { @@ -1438,23 +1449,45 @@ my $test6 = sub { warn "Test6 f: $@"; } + my $blockers = []; eval { PVE::Storage::volume_snapshot($cfg, "$storagename:$vmdisk", 'snap2'); - PVE::Storage::volume_rollback_is_possible($cfg, "$storagename:$vmdisk", 'snap1'); + PVE::Storage::volume_rollback_is_possible($cfg, "$storagename:$vmdisk", 'snap1', $blockers); }; if (!$@) { $count++; - warn "Test6 g: Rollback should not possible"; + warn "Test6 g: Rollback should not be possible"; + } elsif (scalar($blockers->@*) != 1 || $blockers->[0] ne 'snap2') { + $count++; + warn "Test6 g: 'blockers' should be ['snap2']"; } + undef $blockers; + $blockers = []; eval { PVE::Storage::volume_snapshot($cfg, "$storagename:$vmbase", 'snap2'); - PVE::Storage::volume_rollback_is_possible($cfg, "$storagename:$vmbase", 'snap1'); + PVE::Storage::volume_snapshot($cfg, "$storagename:$vmbase", 'snap3'); + PVE::Storage::volume_rollback_is_possible($cfg, "$storagename:$vmbase", 'snap1', $blockers); }; if (!$@) { $count++; - warn "Test6 h: Rollback should not possible"; + warn "Test6 h: Rollback should not be possible"; + } else { + if (scalar($blockers->@*) != 2) { + $count++; + warn "Test6 g: 'blockers' should contain two elements"; + } + my $blockers_hash = { map { $_ => 1 } $blockers->@* }; + if (!$blockers_hash->{'snap2'}) { + $count++; + warn "Test6 g: 'blockers' should contain 'snap2'"; + } + if (!$blockers_hash->{'snap3'}) { + $count++; + warn "Test6 g: 'blockers' should contain 'snap3'"; + } } + undef $blockers; eval { PVE::Storage::volume_snapshot($cfg, "$storagename:$vmlinked", 'snap2'); @@ -1462,7 +1495,7 @@ my $test6 = sub { }; if (!$@) { $count++; - warn "Test6 j: Rollback should not possible"; + warn "Test6 j: Rollback should not be possible"; } eval { @@ -1471,7 +1504,7 @@ my $test6 = sub { }; if (!$@) { $count++; - warn "Test6 k: Rollback should not possible"; + warn "Test6 k: Rollback should not be possible"; } eval { @@ -1480,7 +1513,7 @@ my $test6 = sub { }; if (!$@) { $count++; - warn "Test6 l: Rollback should not possible"; + warn "Test6 l: Rollback should not be possible"; } eval { @@ -1489,7 +1522,7 @@ my $test6 = sub { }; if (!$@) { $count++; - warn "Test6 m: Rollback should not possible"; + warn "Test6 m: Rollback should not be possible"; } }; $tests->{6} = $test6; -- 2.30.2