]> git.proxmox.com Git - qemu-server.git/commitdiff
cfg2cmd: mock SPICE/VNC port allocation methods
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Sat, 21 Sep 2019 11:41:06 +0000 (13:41 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Sat, 21 Sep 2019 11:41:09 +0000 (13:41 +0200)
to make them independent of environment, else other running VMs or
quickly sequential test runs may result in false negative test
results, as the port differed.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
test/run_config2command_tests.pl

index dbec70c1ddab3e07df350a16b244f495c2baf5d7..6f2fe28aeda507f3fb3b3e7429e5c0bda4dafb71 100755 (executable)
@@ -131,6 +131,21 @@ $qemu_server_config->mock(
     },
 );
 
+my $pve_common_tools;
+$pve_common_tools = Test::MockModule->new('PVE::Tools');
+$pve_common_tools->mock(
+    next_vnc_port => sub {
+       my ($family, $address) = @_;
+
+       return '5900';
+    },
+    next_spice_port => sub {
+       my ($family, $address) = @_;
+
+       return '61000';
+    },
+);
+
 sub diff($$) {
     my ($a, $b) = @_;
     return if $a eq $b;