From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id 94E201FF0AB for ; Wed, 23 Sep 2026 17:11:37 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id D8DEB2177B; Wed, 23 Sep 2026 17:10:08 +0200 (CEST) From: "Max R. Carrara" To: pve-devel@lists.proxmox.com Subject: [PATCH pve-storage v2 31/50] test: list volumes: fix broken test checking for vmlist modifications Date: Wed, 23 Sep 2026 17:05:45 +0200 Message-ID: <20260923150606.531239-32-m.carrara@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260923150606.531239-1-m.carrara@proxmox.com> References: <20260923150606.531239-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: 1790176031695 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.406 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust 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: GIONJSY5VTJFLPM23AQABJGVY6LUEULM X-Message-ID-Hash: GIONJSY5VTJFLPM23AQABJGVY6LUEULM 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: This test never actually did anything, since it didn't use the mocked vmlist at all. Therefore, fix it by comparing the vmlist with its original after all tests have run. Verified that this test catches modifications to the vmlist by manually adding a line that modifies it in the `list_volumes()` method, running the tests to see if this fails, and then removing that line again. Signed-off-by: Max R. Carrara --- src/test/list_volumes_test.pm | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/src/test/list_volumes_test.pm b/src/test/list_volumes_test.pm index 053ebbe3..2d941b60 100644 --- a/src/test/list_volumes_test.pm +++ b/src/test/list_volumes_test.pm @@ -719,26 +719,19 @@ sub main() { my $plan = scalar @tests; plan tests => $plan + 1; - { - # don't accidentally modify vmlist, see bug report - # https://pve.proxmox.com/pipermail/pve-devel/2020-January/041096.html - my $scfg_with_type = { path => $storage_dir, type => 'dir' }; - my $original_vmlist = { ids => {} }; - my $tested_vmlist = dclone($original_vmlist); - - PVE::Storage::Plugin->list_volumes('sid', $scfg_with_type, undef, ['images']); - - is_deeply($tested_vmlist, $original_vmlist, 'PVE::Cluster::vmlist remains unmodified') - || diag( - "Expected vmlist to remain\n", - explain($original_vmlist), - "but it turned to\n", - explain($tested_vmlist), - ); - } + # Keep the original vmlist around in order to check whether it was modified + # after running all the tests. See: + # https://pve.proxmox.com/pipermail/pve-devel/2020-January/041096.html + my $original_vmlist = dclone(PVE::Cluster::get_vmlist()); run_legacy_tests(); + my $vmlist = PVE::Cluster::get_vmlist(); + + is_deeply( + $vmlist, $original_vmlist, 'Result of PVE::Cluster::get_vmlist remains unmodified', + ); + done_testing(); return; -- 2.47.3