Skip to content

Commit

Permalink
wip: testing domain attached in both hds
Browse files Browse the repository at this point in the history
  • Loading branch information
frankiejol committed Feb 8, 2024
1 parent 00b4aba commit c2fbea3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 8 additions & 0 deletions t/device/10_templates.t
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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) {
Expand Down

0 comments on commit c2fbea3

Please sign in to comment.