From 3f99d6bbadbbb4d9a72fbaf2b39575a248481cf7 Mon Sep 17 00:00:00 2001 From: Francesc Guasch Date: Mon, 3 Jun 2019 15:05:51 +0000 Subject: [PATCH 1/2] fixed wrong exposed_ports check --- lib/Ravada/Auth/SQL.pm | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/Ravada/Auth/SQL.pm b/lib/Ravada/Auth/SQL.pm index 9b61ca975..854c19865 100644 --- a/lib/Ravada/Auth/SQL.pm +++ b/lib/Ravada/Auth/SQL.pm @@ -446,7 +446,6 @@ sub can_list_machines { || $self->can_clone_all() || $self->can_remove_all() || $self->can_rename_all() - || $self->expose_ports() || $self->can_shutdown_all(); return 0; } From bf5f9a596bf733f8f2a62dbf6613b46d27cd35ca Mon Sep 17 00:00:00 2001 From: Francesc Guasch Date: Mon, 3 Jun 2019 15:06:10 +0000 Subject: [PATCH 2/2] refactor(test): polished some tests Those failed in a busy server --- t/kvm/20_domain_kvm.t | 3 ++- t/nodes/10_basic.t | 2 +- t/request/70_network.t | 8 +++----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/t/kvm/20_domain_kvm.t b/t/kvm/20_domain_kvm.t index 1d1f6294d..9fe05c76e 100644 --- a/t/kvm/20_domain_kvm.t +++ b/t/kvm/20_domain_kvm.t @@ -59,7 +59,7 @@ sub test_remove_corrupt_clone { my $vm = shift; my $base = create_domain($vm); - $base->add_volume_swap(); + $base->add_volume_swap( size => 1024 * 1024 ); my $clone = $base->clone( name => new_domain_name ,user => user_admin @@ -141,6 +141,7 @@ sub test_new_domain_iso { , active => $active , id_owner => $USER->id , iso_file => $iso->{device} , vm => $BACKEND + , disk => 1024 * 1024 ); }; is($@,'') or return; diff --git a/t/nodes/10_basic.t b/t/nodes/10_basic.t index dcbffa11c..9c345c0bc 100644 --- a/t/nodes/10_basic.t +++ b/t/nodes/10_basic.t @@ -220,7 +220,7 @@ sub _create_2_clones_same_port($vm, $node, $base, $ip_local, $ip_remote) { $clone_local->start(user => user_admin, remote_ip => $ip_local); $clone_remote->start(user => user_admin, remote_ip => $ip_remote); - for (1 .. 10 ) { + for (1 .. 100 ) { my ($port_local) = $clone_local->display(user_admin) =~ m{://.*:(\d+)}; my ($port_remote) = $clone_remote->display(user_admin) =~ m{://.*:(\d+)}; diff --git a/t/request/70_network.t b/t/request/70_network.t index ee2975ef2..df740bb07 100644 --- a/t/request/70_network.t +++ b/t/request/70_network.t @@ -67,7 +67,7 @@ sub test_list_bridges($vm) { is($req->status,'done'); is($req->error,''); - my @exp_bridges = _expected_bridges($vm); + my @exp_bridges = sort(_expected_bridges($vm)); is($req->output,encode_json(\@exp_bridges)); my $bridges = rvd_front->list_network_interfaces( @@ -79,19 +79,17 @@ sub test_list_bridges($vm) { SKIP: { skip("No system bridges found",1) if !scalar @exp_bridges; - like($req->output, qr/\["\w+"]/); + like($req->output, qr/\["[\w\d]+".*\]/); } } sub _expected_bridges($vm) { - my $brctl = `which brctl`; chomp $brctl; - return if !$brctl; + return undef if !$brctl; my @exp_bridges = grep { defined $_ && $_ ne 'bridge' } map { /(^\w+)\s*/; $1 } split /\n/,`brctl show`; - @exp_bridges = _remove_qemu_bridges($vm, \@exp_bridges); return @exp_bridges;