[pve-devel] [PATCH storage 3/6] tests: archive info: make deterministic

Thomas Lamprecht t.lamprecht at proxmox.com
Fri May 15 19:23:41 CEST 2020


nothing worse than jumping test results due to not sorting the tests
and thus making discussions harder (which test # failed) and it may
imply another error by mistake.

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 test/archive_info_test.pm | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/test/archive_info_test.pm b/test/archive_info_test.pm
index 60d606e..ce873b3 100644
--- a/test/archive_info_test.pm
+++ b/test/archive_info_test.pm
@@ -71,10 +71,10 @@ my $bkp_suffix = {
 };
 
 # create more test cases for backup files matches
-foreach my $virt (keys %$bkp_suffix) {
-    my ($format, $decomp) = @{ $bkp_suffix->{$virt} };
+for my $virt (sort keys %$bkp_suffix) {
+    my ($format, $decomp) = $bkp_suffix->{$virt}->@*;
 
-    foreach my $suffix (keys %$decomp) {
+    for my $suffix (sort keys %$decomp) {
 	my @arr = (
 	    {
 		description => "Backup archive, $virt, $format.$suffix",
@@ -101,7 +101,7 @@ my $non_bkp_suffix = {
 };
 
 # create tests for failed matches
-foreach my $virt (keys %$non_bkp_suffix) {
+for my $virt (sort keys %$non_bkp_suffix) {
     my $suffix = $non_bkp_suffix->{$virt};
     foreach my $s (@$suffix) {
 	my @arr = (
-- 
2.20.1





More information about the pve-devel mailing list