]> git.proxmox.com Git - pve-storage.git/commitdiff
tests: archive info: avoid assembling arrays to just de-assemble them directly
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 15 May 2020 17:11:48 +0000 (19:11 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 15 May 2020 17:11:48 +0000 (19:11 +0200)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
test/archive_info_test.pm

index ce873b34836789168498ddcef1dbcaa573b7675c..c0343aff4a4d9d38cfcbe29aec7dbdd0f1d2ed72 100644 (file)
@@ -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",
+       };
     }
 }