From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id D440B1FF13B for ; Wed, 22 Apr 2026 13:19:41 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id A58321A0FA; Wed, 22 Apr 2026 13:15:14 +0200 (CEST) From: "Max R. Carrara" To: pve-devel@lists.proxmox.com Subject: [PATCH pve-storage v1 42/54] test: parse volname: move VM disk test creation into separate block Date: Wed, 22 Apr 2026 13:13:08 +0200 Message-ID: <20260422111322.257380-43-m.carrara@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260422111322.257380-1-m.carrara@proxmox.com> References: <20260422111322.257380-1-m.carrara@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1776856360798 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.083 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy 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 Message-ID-Hash: QMHIYOWVNNR4BWXVX5WRE4JVGDNIZRZU X-Message-ID-Hash: QMHIYOWVNNR4BWXVX5WRE4JVGDNIZRZU X-MailFrom: m.carrara@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: For future organizational purposes, move the loop that adds more test cases for VM images into its own block. Signed-off-by: Max R. Carrara --- src/test/parse_volname_test.pm | 75 +++++++++++++++++++--------------- 1 file changed, 42 insertions(+), 33 deletions(-) diff --git a/src/test/parse_volname_test.pm b/src/test/parse_volname_test.pm index ea07c56b..3777e6e8 100644 --- a/src/test/parse_volname_test.pm +++ b/src/test/parse_volname_test.pm @@ -226,40 +226,49 @@ my $tests = [ }, ]; -# create more test cases for VM disk images matches -my $disk_suffix = ['raw', 'qcow2', 'vmdk']; -for my $s ($disk_suffix->@*) { - my @arr = ( - { - description => "VM disk image, $s", - volname => "$vmid/vm-$vmid-disk-1.$s", - expected => [ - 'images', "vm-$vmid-disk-1.$s", "$vmid", undef, undef, undef, "$s", - ], - }, - { - description => "VM disk image, linked, $s", - volname => "$vmid/base-$vmid-disk-0.$s/$vmid/vm-$vmid-disk-0.$s", - expected => [ - 'images', - "vm-$vmid-disk-0.$s", - "$vmid", - "base-$vmid-disk-0.$s", - "$vmid", - undef, - "$s", - ], - }, - { - description => "VM disk image, base, $s", - volname => "$vmid/base-$vmid-disk-0.$s", - expected => [ - 'images', "base-$vmid-disk-0.$s", "$vmid", undef, undef, 'base-', "$s", - ], - }, - ); +# Additional test cases for VM disk images +{ + my $disk_suffixes = ['raw', 'qcow2', 'vmdk']; - push($tests->@*, @arr); + for my $suffix ($disk_suffixes->@*) { + my @extra_tests = ( + { + description => "VM disk image, $suffix", + volname => "$vmid/vm-$vmid-disk-1.$suffix", + expected => [ + 'images', "vm-$vmid-disk-1.$suffix", "$vmid", undef, undef, undef, $suffix, + ], + }, + { + description => "VM disk image, linked, $suffix", + volname => "$vmid/base-$vmid-disk-0.$suffix/$vmid/vm-$vmid-disk-0.$suffix", + expected => [ + 'images', + "vm-$vmid-disk-0.$suffix", + "$vmid", + "base-$vmid-disk-0.$suffix", + "$vmid", + undef, + $suffix, + ], + }, + { + description => "VM disk image, base, $suffix", + volname => "$vmid/base-$vmid-disk-0.$suffix", + expected => [ + 'images', + "base-$vmid-disk-0.$suffix", + "$vmid", + undef, + undef, + 'base-', + $suffix, + ], + }, + ); + + push($tests->@*, @extra_tests); + } } # create more test cases for backup files matches -- 2.47.3