From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 8319B1FF09F for ; Thu, 17 Sep 2026 18:24:38 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 2A8CE21666; Thu, 17 Sep 2026 18:23:51 +0200 (CEST) From: =?UTF-8?q?Michael=20K=C3=B6ppl?= To: pve-devel@lists.proxmox.com Subject: [PATCH e2e-tests 5/6] tests: use random_vmid function for getting VMIDs Date: Thu, 17 Sep 2026 18:23:23 +0200 Message-ID: <20260917162324.1926056-6-m.koeppl@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260917162324.1926056-1-m.koeppl@proxmox.com> References: <20260917162324.1926056-1-m.koeppl@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1789662222767 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.605 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 RCVD_IN_MSPIKE_H2 0.001 Average reputation (+2) 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: JCH7X32IEDDRO3GTXYLZ5LDHKF3O27QM X-Message-ID-Hash: JCH7X32IEDDRO3GTXYLZ5LDHKF3O27QM X-MailFrom: m.koeppl@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: Signed-off-by: Michael Köppl --- tests/pbs/test_pbs_s3_datastore.pl | 5 +++-- tests/pve_backup_job.pl | 3 ++- tests/pve_create_pool.pl | 3 ++- tests/pve_create_vm.pl | 4 ++-- tests/pve_firewall.pl | 4 ++-- tests/pve_ha_resource_config.pl | 3 ++- tests/pve_ha_resource_state.pl | 4 ++-- tests/pve_ha_rules_config.pl | 5 +++-- tests/pve_ha_status.pl | 3 ++- tests/pve_migration.pl | 4 ++-- tests/pve_replication.pl | 3 ++- tests/pve_storage_basic.pl | 3 ++- 12 files changed, 26 insertions(+), 18 deletions(-) diff --git a/tests/pbs/test_pbs_s3_datastore.pl b/tests/pbs/test_pbs_s3_datastore.pl index a35c6e9..8eb6bab 100755 --- a/tests/pbs/test_pbs_s3_datastore.pl +++ b/tests/pbs/test_pbs_s3_datastore.pl @@ -28,6 +28,7 @@ use lib '.'; use Proxmox::Test::Helper qw(get_instance get_pbs_instance get_pve_instance); use Proxmox::Test::ProxmoxInstance; use Proxmox::Test::Testcase; +use Proxmox::Test::Util qw(random_vmid); my $pve = get_pve_instance('pve1'); my $pbs = get_pbs_instance('pbs1'); @@ -122,7 +123,7 @@ Proxmox::Test::Testcase->new('pbs_s3_datastore')->with([{}])->step( )->step( 'create dummy VM with two 4 GB disks on PVE', sub { - $vmid = $pve->client()->get('/cluster/nextid'); + $vmid = random_vmid($pve->client()); my $upid = $pve->client()->post( "/nodes/$node/qemu", { @@ -182,7 +183,7 @@ Proxmox::Test::Testcase->new('pbs_s3_datastore')->with([{}])->step( )->step( 'restore VM on PVE from PBS backup', sub { - $restore_vmid = $pve->client()->get('/cluster/nextid'); + $restore_vmid = random_vmid($pve->client()); my $upid = $pve->client()->post( "/nodes/$node/qemu", { diff --git a/tests/pve_backup_job.pl b/tests/pve_backup_job.pl index 6ba59eb..c3699e2 100755 --- a/tests/pve_backup_job.pl +++ b/tests/pve_backup_job.pl @@ -6,6 +6,7 @@ use Test::More; use lib '.'; use Proxmox::Test::Helper qw(get_pve_instance); +use Proxmox::Test::Util qw(random_vmid); # Tests scheduled backup job CRUD and an immediate vzdump run. # @@ -23,7 +24,7 @@ my $pve = get_pve_instance('pve1'); my $node = $pve->get_nodename(); # Create a test VM to target with the backup job and the immediate vzdump run. -my $vmid = $pve->client()->get('/cluster/nextid'); +my $vmid = random_vmid($pve->client()); my $upid = $pve->client()->post( "/nodes/$node/qemu", { diff --git a/tests/pve_create_pool.pl b/tests/pve_create_pool.pl index fa8b351..e54bf8d 100755 --- a/tests/pve_create_pool.pl +++ b/tests/pve_create_pool.pl @@ -6,6 +6,7 @@ use Test::More; use lib '.'; use Proxmox::Test::Helper qw(get_pve_instance); +use Proxmox::Test::Util qw(random_vmid); # Tests resource pools end to end: a pool is not just a named config entry, it actually groups # guests and is reflected in the cluster resource view. Beyond create/update/delete this adds a @@ -27,7 +28,7 @@ my $res = $client->get("/pools/$pool_id", {}); is($res->{comment}, 'Created by automated test', 'pool created with the given comment'); # Create a VM and actually put it into the pool. -my $vmid = $client->get('/cluster/nextid'); +my $vmid = random_vmid($client); my $upid = $client->post("/nodes/$node/qemu", { vmid => $vmid, name => 'e2e-pool-test' }); is($pve->wait_for_task($upid), 'OK', 'test VM created'); diff --git a/tests/pve_create_vm.pl b/tests/pve_create_vm.pl index 9954b09..3d0ced1 100755 --- a/tests/pve_create_vm.pl +++ b/tests/pve_create_vm.pl @@ -6,12 +6,12 @@ use Test::More; use lib '.'; use Proxmox::Test::Helper qw(get_pve_instance); -use Proxmox::Test::Util qw(poll_until); +use Proxmox::Test::Util qw(random_vmid poll_until); use Data::Dumper; my $instance = get_pve_instance("pve1"); -my $vmid = $instance->client()->get("/cluster/nextid"); +my $vmid = random_vmid($instance->client()); my $upid; diff --git a/tests/pve_firewall.pl b/tests/pve_firewall.pl index e1f6ec2..ed4e2fc 100755 --- a/tests/pve_firewall.pl +++ b/tests/pve_firewall.pl @@ -6,7 +6,7 @@ use Test::More; use lib '.'; use Proxmox::Test::Helper qw(get_pve_instance); -use Proxmox::Test::Util qw(poll_until); +use Proxmox::Test::Util qw(random_vmid poll_until); use Proxmox::Test::SDN qw(CONTAINER_TEMPLATE); # End-to-end test of the PVE firewall: verifies a rule actually affects the dataplane, rather than @@ -31,7 +31,7 @@ my $pve = get_pve_instance('pve1'); my $node = $pve->get_nodename(); my $client = $pve->client(); -my $vmid = $client->get('/cluster/nextid'); +my $vmid = random_vmid($client); my $ct_ip = '10.250.250.10'; my $node_ip = '10.250.250.1'; diff --git a/tests/pve_ha_resource_config.pl b/tests/pve_ha_resource_config.pl index ffadc64..6bd9348 100755 --- a/tests/pve_ha_resource_config.pl +++ b/tests/pve_ha_resource_config.pl @@ -6,6 +6,7 @@ use Test::More; use lib '.'; use Proxmox::Test::Helper qw(get_pve_instance); +use Proxmox::Test::Util qw(random_vmid); # Tests HA resource configuration CRUD operations. # @@ -19,7 +20,7 @@ my $pve = get_pve_instance('pve1-cluster'); my $node = $pve->get_nodename(); # We need a VM to register as an HA resource. Create a minimal one first. -my $vmid = $pve->client()->get("/cluster/nextid"); +my $vmid = random_vmid($pve->client()); my $upid = $pve->client()->post("/nodes/localhost/qemu", { vmid => $vmid, diff --git a/tests/pve_ha_resource_state.pl b/tests/pve_ha_resource_state.pl index dddfb79..ab63ca0 100755 --- a/tests/pve_ha_resource_state.pl +++ b/tests/pve_ha_resource_state.pl @@ -6,7 +6,7 @@ use Test::More; use lib '.'; use Proxmox::Test::Helper qw(get_pve_instance); -use Proxmox::Test::Util qw(poll_until); +use Proxmox::Test::Util qw(random_vmid poll_until); # End-to-end test of HA resource state: verifies the HA stack actually acts on the requested state # (the CRM/LRM start and stop the managed guest), rather than only checking that the requested @@ -20,7 +20,7 @@ my $client = $pve->client(); # Create a small VM to be HA-managed. It needs no disk: HA only has to bring the QEMU process up # for the service to be 'running'. -my $vmid = $client->get('/cluster/nextid'); +my $vmid = random_vmid($client); my $upid = $client->post("/nodes/$node/qemu", { vmid => $vmid, memory => 256, name => 'e2e-ha-test' }); is($pve->wait_for_task($upid), 'OK', 'test VM created'); diff --git a/tests/pve_ha_rules_config.pl b/tests/pve_ha_rules_config.pl index 88ec3cc..328d55b 100755 --- a/tests/pve_ha_rules_config.pl +++ b/tests/pve_ha_rules_config.pl @@ -6,6 +6,7 @@ use Test::More; use lib '.'; use Proxmox::Test::Helper qw(get_pve_instance); +use Proxmox::Test::Util qw(random_vmid); # Based on the following simulation test scenarios: # test-node-affinity-strict1/2: node-affinity with strict=1 @@ -18,11 +19,11 @@ my $pve = get_pve_instance('pve1-cluster'); my $node = $pve->get_nodename(); # Create two test VMs to use as HA resources -my $vmid1 = $pve->client()->get("/cluster/nextid"); +my $vmid1 = random_vmid($pve->client()); my $upid = $pve->client()->post("/nodes/localhost/qemu", { vmid => $vmid1 }); is($pve->wait_for_task($upid), "OK", "VM created successfully"); -my $vmid2 = $pve->client()->get("/cluster/nextid"); +my $vmid2 = random_vmid($pve->client()); $upid = $pve->client()->post("/nodes/localhost/qemu", { vmid => $vmid2 }); is($pve->wait_for_task($upid), "OK", "VM created successfully"); diff --git a/tests/pve_ha_status.pl b/tests/pve_ha_status.pl index f4b4444..8e789e5 100755 --- a/tests/pve_ha_status.pl +++ b/tests/pve_ha_status.pl @@ -6,6 +6,7 @@ use Test::More; use lib '.'; use Proxmox::Test::Helper qw(get_pve_instance); +use Proxmox::Test::Util qw(random_vmid); # Tests the HA status API endpoints. # @@ -59,7 +60,7 @@ if ($lrm_entry) { # Service appears in status after registration -my $vmid = $pve->client()->get("/cluster/nextid"); +my $vmid = random_vmid($pve->client()); my $upid = $pve->client()->post("/nodes/localhost/qemu", { vmid => $vmid }); is($pve->wait_for_task($upid), "OK", "test VM created"); diff --git a/tests/pve_migration.pl b/tests/pve_migration.pl index 5e0fe60..3997eda 100755 --- a/tests/pve_migration.pl +++ b/tests/pve_migration.pl @@ -6,7 +6,7 @@ use Test::More; use lib '.'; use Proxmox::Test::Helper qw(get_pve_instance); -use Proxmox::Test::Util qw(poll_until); +use Proxmox::Test::Util qw(random_vmid poll_until); # Tests offline and online (live) migration of a guest between two cluster nodes. # @@ -43,7 +43,7 @@ my $on_node = sub { return scalar(grep { $_->{vmid} == $vmid } @$list) > 0; }; -my $vmid = $a->client()->get('/cluster/nextid'); +my $vmid = random_vmid($a->client()); # Create a small VM on node A. No disks on shared storage, so the offline migration moves the # guest config; an online migration of a diskless VM exercises the live-migration code path. diff --git a/tests/pve_replication.pl b/tests/pve_replication.pl index 158828d..0021dac 100755 --- a/tests/pve_replication.pl +++ b/tests/pve_replication.pl @@ -7,6 +7,7 @@ use Test::More; use lib '.'; use Proxmox::Test::Helper qw(get_pve_instance); use Proxmox::Test::Testcase; +use Proxmox::Test::Util qw(random_vmid); # Tests storage replication job CRUD between two cluster nodes. # @@ -52,7 +53,7 @@ my $job_id; Proxmox::Test::Testcase->new('pve_replication')->with([{}])->step( 'create ZFS-backed VM on node A', sub { - $vmid = $a->client()->get('/cluster/nextid'); + $vmid = random_vmid($a->client()); my $upid = $a->client()->post( "/nodes/$node_a/qemu", { diff --git a/tests/pve_storage_basic.pl b/tests/pve_storage_basic.pl index 6c17e28..50a7d9d 100755 --- a/tests/pve_storage_basic.pl +++ b/tests/pve_storage_basic.pl @@ -6,6 +6,7 @@ use Test::More; use lib '.'; use Proxmox::Test::Helper qw(get_pve_instance); +use Proxmox::Test::Util qw(random_vmid); # Tests storage end to end: a newly defined storage must actually be usable, so this allocates a # real volume on it and verifies the volume shows up in (and can be freed from) the storage @@ -40,7 +41,7 @@ is($client->get("/storage/$storage_id", {})->{path}, '/var/tmp/testdir1', 'stora eval { # Allocate a real disk image on the new storage. - my $vmid = $client->get('/cluster/nextid'); + my $vmid = random_vmid($client); my $volid = $client->post( "/nodes/$node/storage/$storage_id/content", { -- 2.47.3