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 8433B1FF13B for ; Wed, 22 Apr 2026 13:20:42 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id CBD6C1AA7C; Wed, 22 Apr 2026 13:15:55 +0200 (CEST) From: "Max R. Carrara" To: pve-devel@lists.proxmox.com Subject: [PATCH pve-storage v1 46/54] test: volume id: rename 'volname' test case parameter to 'file' Date: Wed, 22 Apr 2026 13:13:12 +0200 Message-ID: <20260422111322.257380-47-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: 1776856365180 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: QEMFIA5OPYHWHU5BIV7RMRO6J22NTTZH X-Message-ID-Hash: QEMFIA5OPYHWHU5BIV7RMRO6J22NTTZH 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: ... since it's for file paths, not volume names. Improve the comment describing the test case format along the way. Signed-off-by: Max R. Carrara --- src/test/path_to_volume_id_test.pm | 72 ++++++++++++++---------------- 1 file changed, 34 insertions(+), 38 deletions(-) diff --git a/src/test/path_to_volume_id_test.pm b/src/test/path_to_volume_id_test.pm index 72644482..6c7d0d67 100644 --- a/src/test/path_to_volume_id_test.pm +++ b/src/test/path_to_volume_id_test.pm @@ -39,28 +39,28 @@ my $DEFAULT_CFG = { }, }; -# the tests array consists of hashes with the following keys: -# description => to identify the test case -# volname => to create the test file -# expected => the result that path_to_volume_id should return +# Each test is comprised of the following keys: +# description => to identify a single test +# file => the absolute path to the volume's file that should be parsed +# expected => expected output of path_to_volume_id(), as listref my $tests = [ { description => 'Image, qcow2', - volname => "$DEFAULT_STORAGE_DIR/images/16110/vm-16110-disk-0.qcow2", + file => "$DEFAULT_STORAGE_DIR/images/16110/vm-16110-disk-0.qcow2", expected => [ 'images', 'local:16110/vm-16110-disk-0.qcow2', ], }, { description => 'Image, raw', - volname => "$DEFAULT_STORAGE_DIR/images/16112/vm-16112-disk-0.raw", + file => "$DEFAULT_STORAGE_DIR/images/16112/vm-16112-disk-0.raw", expected => [ 'images', 'local:16112/vm-16112-disk-0.raw', ], }, { description => 'Image template, qcow2', - volname => "$DEFAULT_STORAGE_DIR/images/9004/base-9004-disk-0.qcow2", + file => "$DEFAULT_STORAGE_DIR/images/9004/base-9004-disk-0.qcow2", expected => [ 'images', 'local:9004/base-9004-disk-0.qcow2', ], @@ -68,49 +68,49 @@ my $tests = [ { description => 'Backup, vma.gz', - volname => "$DEFAULT_STORAGE_DIR/dump/vzdump-qemu-16110-2020_03_30-21_11_40.vma.gz", + file => "$DEFAULT_STORAGE_DIR/dump/vzdump-qemu-16110-2020_03_30-21_11_40.vma.gz", expected => [ 'backup', 'local:backup/vzdump-qemu-16110-2020_03_30-21_11_40.vma.gz', ], }, { description => 'Backup, vma.lzo', - volname => "$DEFAULT_STORAGE_DIR/dump/vzdump-qemu-16110-2020_03_30-21_12_45.vma.lzo", + file => "$DEFAULT_STORAGE_DIR/dump/vzdump-qemu-16110-2020_03_30-21_12_45.vma.lzo", expected => [ 'backup', 'local:backup/vzdump-qemu-16110-2020_03_30-21_12_45.vma.lzo', ], }, { description => 'Backup, vma', - volname => "$DEFAULT_STORAGE_DIR/dump/vzdump-qemu-16110-2020_03_30-21_13_55.vma", + file => "$DEFAULT_STORAGE_DIR/dump/vzdump-qemu-16110-2020_03_30-21_13_55.vma", expected => [ 'backup', 'local:backup/vzdump-qemu-16110-2020_03_30-21_13_55.vma', ], }, { description => 'Backup, tar.lzo', - volname => "$DEFAULT_STORAGE_DIR/dump/vzdump-lxc-16112-2020_03_30-21_39_30.tar.lzo", + file => "$DEFAULT_STORAGE_DIR/dump/vzdump-lxc-16112-2020_03_30-21_39_30.tar.lzo", expected => [ 'backup', 'local:backup/vzdump-lxc-16112-2020_03_30-21_39_30.tar.lzo', ], }, { description => 'Backup, vma.zst', - volname => "$DEFAULT_STORAGE_DIR/dump/vzdump-qemu-16110-2020_03_30-21_13_55.vma.zst", + file => "$DEFAULT_STORAGE_DIR/dump/vzdump-qemu-16110-2020_03_30-21_13_55.vma.zst", expected => [ 'backup', 'local:backup/vzdump-qemu-16110-2020_03_30-21_13_55.vma.zst', ], }, { description => 'Backup, tar.zst', - volname => "$DEFAULT_STORAGE_DIR/dump/vzdump-lxc-16112-2020_03_30-21_39_30.tar.zst", + file => "$DEFAULT_STORAGE_DIR/dump/vzdump-lxc-16112-2020_03_30-21_39_30.tar.zst", expected => [ 'backup', 'local:backup/vzdump-lxc-16112-2020_03_30-21_39_30.tar.zst', ], }, { description => 'Backup, tar.bz2', - volname => "$DEFAULT_STORAGE_DIR/dump/vzdump-openvz-16112-2020_03_30-21_39_30.tar.bz2", + file => "$DEFAULT_STORAGE_DIR/dump/vzdump-openvz-16112-2020_03_30-21_39_30.tar.bz2", expected => [ 'backup', 'local:backup/vzdump-openvz-16112-2020_03_30-21_39_30.tar.bz2', ], @@ -118,23 +118,21 @@ my $tests = [ { description => 'ISO file', - volname => "$DEFAULT_STORAGE_DIR/template/iso/yet-again-a-installation-disk.iso", + file => "$DEFAULT_STORAGE_DIR/template/iso/yet-again-a-installation-disk.iso", expected => [ 'iso', 'local:iso/yet-again-a-installation-disk.iso', ], }, { description => 'CT template, tar.gz', - volname => - "$DEFAULT_STORAGE_DIR/template/cache/debian-10.0-standard_10.0-1_amd64.tar.gz", + file => "$DEFAULT_STORAGE_DIR/template/cache/debian-10.0-standard_10.0-1_amd64.tar.gz", expected => [ 'vztmpl', 'local:vztmpl/debian-10.0-standard_10.0-1_amd64.tar.gz', ], }, { description => 'CT template, wrong ending, tar bz2', - volname => - "$DEFAULT_STORAGE_DIR/template/cache/debian-10.0-standard_10.0-1_amd64.tar.bz2", + file => "$DEFAULT_STORAGE_DIR/template/cache/debian-10.0-standard_10.0-1_amd64.tar.bz2", expected => [ 'vztmpl', 'local:vztmpl/debian-10.0-standard_10.0-1_amd64.tar.bz2', ], @@ -142,50 +140,49 @@ my $tests = [ { description => 'Rootdir, folder subvol, legacy naming', - volname => "$DEFAULT_STORAGE_DIR/images/1234/subvol-1234-disk-0.subvol/", # fileparse needs / at the end + file => "$DEFAULT_STORAGE_DIR/images/1234/subvol-1234-disk-0.subvol/", # fileparse needs / at the end expected => [ 'images', 'local:1234/subvol-1234-disk-0.subvol', ], }, { description => 'Rootdir, folder subvol', - volname => "$DEFAULT_STORAGE_DIR/images/1234/subvol-1234-disk-0.subvol/", # fileparse needs / at the end + file => "$DEFAULT_STORAGE_DIR/images/1234/subvol-1234-disk-0.subvol/", # fileparse needs / at the end expected => [ 'images', 'local:1234/subvol-1234-disk-0.subvol', ], }, { description => 'Snippets, yaml', - volname => "$DEFAULT_STORAGE_DIR/snippets/userconfig.yaml", + file => "$DEFAULT_STORAGE_DIR/snippets/userconfig.yaml", expected => [ 'snippets', 'local:snippets/userconfig.yaml', ], }, { description => 'Snippets, hookscript', - volname => "$DEFAULT_STORAGE_DIR/snippets/hookscript.pl", + file => "$DEFAULT_STORAGE_DIR/snippets/hookscript.pl", expected => [ 'snippets', 'local:snippets/hookscript.pl', ], }, { description => 'CT template, tar.xz', - volname => - "$DEFAULT_STORAGE_DIR/template/cache/debian-10.0-standard_10.0-1_amd64.tar.xz", + file => "$DEFAULT_STORAGE_DIR/template/cache/debian-10.0-standard_10.0-1_amd64.tar.xz", expected => [ 'vztmpl', 'local:vztmpl/debian-10.0-standard_10.0-1_amd64.tar.xz', ], }, { description => 'Import, ova', - volname => "$DEFAULT_STORAGE_DIR/import/import.ova", + file => "$DEFAULT_STORAGE_DIR/import/import.ova", expected => [ 'import', 'local:import/import.ova', ], }, { description => 'Import, ovf', - volname => "$DEFAULT_STORAGE_DIR/import/import.ovf", + file => "$DEFAULT_STORAGE_DIR/import/import.ovf", expected => [ 'import', 'local:import/import.ovf', ], @@ -194,48 +191,47 @@ my $tests = [ # no matches, path or files with failures { description => 'Base template, string as vmid in folder name', - volname => "$DEFAULT_STORAGE_DIR/images/ssss/base-4321-disk-0.raw", + file => "$DEFAULT_STORAGE_DIR/images/ssss/base-4321-disk-0.raw", expected => [''], }, { description => 'ISO file, wrong ending', - volname => "$DEFAULT_STORAGE_DIR/template/iso/yet-again-a-installation-disk.dvd", + file => "$DEFAULT_STORAGE_DIR/template/iso/yet-again-a-installation-disk.dvd", expected => [''], }, { description => 'CT template, wrong ending, zip.gz', - volname => - "$DEFAULT_STORAGE_DIR/template/cache/debian-10.0-standard_10.0-1_amd64.zip.gz", + file => "$DEFAULT_STORAGE_DIR/template/cache/debian-10.0-standard_10.0-1_amd64.zip.gz", expected => [''], }, { description => 'Backup, wrong format, openvz, zip.gz', - volname => "$DEFAULT_STORAGE_DIR/dump/vzdump-openvz-16112-2020_03_30-21_39_30.zip.gz", + file => "$DEFAULT_STORAGE_DIR/dump/vzdump-openvz-16112-2020_03_30-21_39_30.zip.gz", expected => [''], }, { description => 'Backup, wrong format, openvz, tgz.lzo', - volname => "$DEFAULT_STORAGE_DIR/dump/vzdump-openvz-16112-2020_03_30-21_39_30.tgz.lzo", + file => "$DEFAULT_STORAGE_DIR/dump/vzdump-openvz-16112-2020_03_30-21_39_30.tgz.lzo", expected => [''], }, { description => 'Backup, wrong ending, qemu, vma.xz', - volname => "$DEFAULT_STORAGE_DIR/dump/vzdump-qemu-16110-2020_03_30-21_12_40.vma.xz", + file => "$DEFAULT_STORAGE_DIR/dump/vzdump-qemu-16110-2020_03_30-21_12_40.vma.xz", expected => [''], }, { description => 'Backup, wrong format, qemu, vms.gz', - volname => "$DEFAULT_STORAGE_DIR/dump/vzdump-qemu-16110-2020_03_30-21_12_40.vms.gz", + file => "$DEFAULT_STORAGE_DIR/dump/vzdump-qemu-16110-2020_03_30-21_12_40.vms.gz", expected => [''], }, { description => 'Image, string as vmid in folder name', - volname => "$DEFAULT_STORAGE_DIR/images/ssss/vm-1234-disk-0.qcow2", + file => "$DEFAULT_STORAGE_DIR/images/ssss/vm-1234-disk-0.qcow2", expected => [''], }, { description => 'Import, non ova/ovf/disk image in import dir', - volname => "$DEFAULT_STORAGE_DIR/import/test.foo", + file => "$DEFAULT_STORAGE_DIR/import/test.foo", expected => [''], }, ]; @@ -245,7 +241,7 @@ my sub run_tests($tests) { my $vtype_subdirs = { map { $_ => 1 } keys plugin_get_default_vtype_subdirs()->%* }; for my $t ($tests->@*) { - my $file = $t->{volname}; + my $file = $t->{file}; my $expected = $t->{expected}; my $description = $t->{description}; -- 2.47.3