[pve-devel] [PATCH storage 4/6] tests: archive info: avoid assembling arrays to just de-assemble them directly
Thomas Lamprecht
t.lamprecht at proxmox.com
Fri May 15 19:23:42 CEST 2020
Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
test/archive_info_test.pm | 38 +++++++++++++++-----------------------
1 file changed, 15 insertions(+), 23 deletions(-)
diff --git a/test/archive_info_test.pm b/test/archive_info_test.pm
index ce873b3..c0343af 100644
--- a/test/archive_info_test.pm
+++ b/test/archive_info_test.pm
@@ -75,20 +75,16 @@ for my $virt (sort keys %$bkp_suffix) {
my ($format, $decomp) = $bkp_suffix->{$virt}->@*;
for my $suffix (sort keys %$decomp) {
- my @arr = (
- {
- description => "Backup archive, $virt, $format.$suffix",
- archive => "backup/vzdump-$virt-$vmid-2020_03_30-21_12_40.$format.$suffix",
- expected => {
- 'type' => "$virt",
- 'format' => "$format",
- 'decompressor' => $decomp->{$suffix},
- 'compression' => "$suffix",
- },
+ push @$tests, {
+ description => "Backup archive, $virt, $format.$suffix",
+ archive => "backup/vzdump-$virt-$vmid-2020_03_30-21_12_40.$format.$suffix",
+ expected => {
+ 'type' => "$virt",
+ 'format' => "$format",
+ 'decompressor' => $decomp->{$suffix},
+ 'compression' => "$suffix",
},
- );
-
- push @$tests, @arr;
+ };
}
}
@@ -103,16 +99,12 @@ my $non_bkp_suffix = {
# create tests for failed matches
for my $virt (sort keys %$non_bkp_suffix) {
my $suffix = $non_bkp_suffix->{$virt};
- foreach my $s (@$suffix) {
- my @arr = (
- {
- description => "Failed match: Backup archive, $virt, $s",
- archive => "backup/vzdump-$virt-$vmid-2020_03_30-21_12_40.$s",
- expected => "ERROR: couldn't determine format and compression type\n",
- },
- );
-
- push @$tests, @arr;
+ for my $s (@$suffix) {
+ push @$tests, {
+ description => "Failed match: Backup archive, $virt, $s",
+ archive => "backup/vzdump-$virt-$vmid-2020_03_30-21_12_40.$s",
+ expected => "ERROR: couldn't determine format and compression type\n",
+ };
}
}
--
2.20.1
More information about the pve-devel
mailing list