Commit 630e390f authored by Francesc Guasch's avatar Francesc Guasch
Browse files

refactor(test): wait for forced shutdown properly

parent 9006fa79
......@@ -3,7 +3,7 @@ package Ravada;
use warnings;
use strict;
our $VERSION = '0.6.0';
our $VERSION = '0.6.1-beta1';
use Carp qw(carp croak);
use Data::Dumper;
......
......@@ -2794,6 +2794,11 @@ sub _post_resume {
return $self->_post_start(@_);
}
sub _timeout_shutdown($self, $value) {
$TIMEOUT_SHUTDOWN = $value if defined $value;
return $TIMEOUT_SHUTDOWN;
}
sub _post_start {
my $self = shift;
my %arg;
......
......@@ -436,6 +436,7 @@ sub test_already_started_hibernated($vm_name, $node) {
start_domain_internal($clone);
$clone_local->_set_spice_ip(1,$vm->ip) if $clone_local->type eq 'KVM';
hibernate_domain_internal($clone_local);
$clone->_timeout_shutdown(4);
is($clone->is_active, 1,"expecting clone active on remote");
is($clone_local->is_hibernated, 1, "expecting clone hibernated on local");
......@@ -444,16 +445,17 @@ sub test_already_started_hibernated($vm_name, $node) {
eval { $clone2->start(user => user_admin) };
like($@,qr/already running/) if $@;
rvd_back->_process_all_requests_dont_fork();
rvd_back->_process_all_requests_dont_fork(1);
for ( 1 .. 120 ) {
last if $clone->is_active
&& !$clone_local->is_active
&& !$clone_local->is_hibernated;
sleep 1;
}
rvd_back->_process_all_requests_dont_fork();
wait_request( debug => 1 );
is($clone->is_active, 0,"[$vm_name] expected ".$clone->name." down");
is($clone->is_active, 0,"[$vm_name] expected ".$clone->name." down in "
.$clone->_vm->name." ".$clone->_vm->id) or exit;
is($clone_local->is_active, 0,"[$vm_name] expected ".$clone->name." down") or exit;
$clone->remove(user_admin);
......@@ -1171,6 +1173,7 @@ SKIP: {
next;
};
is($node->is_local,0,"Expecting ".$node->name." ".$node->ip." is remote" ) or BAIL_OUT();
test_already_started_hibernated($vm_name, $node);
is($vm->shared_storage($node,'/var/tmp/'),0) or exit;
test_already_started_twice($vm_name, $node);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment