From ff9e7dc1bb6b9506231628118ab5e44792157295 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Sat, 21 Sep 2019 13:41:06 +0200 Subject: [PATCH] cfg2cmd: mock SPICE/VNC port allocation methods 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 --- test/run_config2command_tests.pl | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/run_config2command_tests.pl b/test/run_config2command_tests.pl index dbec70c1..6f2fe28a 100755 --- a/test/run_config2command_tests.pl +++ b/test/run_config2command_tests.pl @@ -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;