From c2fbea31e91ea40502a70d145ebc67a23d09e787 Mon Sep 17 00:00:00 2001 From: Francesc Guasch Date: Thu, 8 Feb 2024 16:28:12 +0100 Subject: [PATCH] wip: testing domain attached in both hds --- MANIFEST | 2 +- t/device/10_templates.t | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/MANIFEST b/MANIFEST index 2905cd925..ea4e194d6 100644 --- a/MANIFEST +++ b/MANIFEST @@ -55,6 +55,6 @@ lib/Ravada/I18N/ca.po lib/Ravada/NetInterface.pm lib/Ravada/Auth.pm lib/Ravada/Domain.pm -lib/Ravada/Network.pm +lib/Ravada/Routes.pm script/rvd_front script/rvd_back diff --git a/t/device/10_templates.t b/t/device/10_templates.t index cfb6a3059..057705401 100644 --- a/t/device/10_templates.t +++ b/t/device/10_templates.t @@ -589,6 +589,10 @@ sub test_frontend_list($vm) { my $hd1 = _mock_hd($vm , $path); my $hd2 = _mock_hd($vm , $path); + if (scalar($hd1->list_devices) != scalar($hd2->list_devices)) { + die "Error: expecting the same count of devices in both mock hds"; + } + my $domain = _create_domain_hd($vm, $hd1); $domain->start(user_admin); @@ -597,17 +601,21 @@ sub test_frontend_list($vm) { ,login => user_admin->name }; my $front_devices = Ravada::WebSocket::_list_host_devices(rvd_front(), $ws_args); + is(scalar(@$front_devices),2) or exit; my ($dev_attached) = ($domain->list_host_devices_attached); + my $found=0; for my $fd ( @$front_devices ) { for my $dev ( @{$fd->{devices}} ) { if ($dev->{name} eq $dev_attached->{name}) { ok($dev->{domain} , "Expecting domains listed in ".$dev->{name}) or next; is($dev->{domain}->{id}, $domain->id,"Expecting ".$domain->name." attached in ".$dev->{name}); + $found++ if $dev->{domain}->{id} == $domain->id; } } } + is($found,2) or exit; } sub _mock_hd($vm, $path) {