Commit d3959ee9 authored by Francesc Guasch's avatar Francesc Guasch
Browse files

[#100] reviewed tests for long requests

parent 5e9dc583
......@@ -116,7 +116,7 @@ sub test_req_create_domain_iso {
ok($req->status eq 'requested'
,"$$ Status of request is ".$req->status." it should be requested");
$ravada->process_requests();
$ravada->process_requests(1);
$ravada->_wait_pids();
wait_request($req);
......@@ -195,7 +195,10 @@ sub test_req_remove_domain_name {
my $req = Ravada::Request->remove_domain(name => $name, uid => user_admin()->id);
$ravada->_process_requests_dont_fork();
rvd_back->_process_all_requests_dont_fork();
ok($req->status eq 'done',ref($vm)." status ".$req->status." should be done");
ok(!$req->error ,ref($vm)." error : '".$req->error."' , should be ''");
my $domain = $vm->search_domain($name);
ok(!$domain,ref($vm)." Domain $name should be removed") or exit;
......
......@@ -127,7 +127,7 @@ sub test_start {
#
# stop
my $req3 = Ravada::Request->shutdown_domain(name => $name, uid => $USER->id, timeout => 2);
my $req3 = Ravada::Request->force_shutdown_domain(name => $name, uid => $USER->id);
$RAVADA->process_requests();
wait_request($req3);
ok($req3->status eq 'done',"[$vm_name] expecting request done , got "
......@@ -137,6 +137,10 @@ sub test_start {
my $vm = $RAVADA->search_vm($vm_name);
my $domain3 = $vm->search_domain($name);
for ( 1 .. 60 ) {
last if !$domain3->is_active;
sleep 1;
}
ok(!$domain3->is_active,"Domain $name should not be active");
return $domain3;
......
......@@ -27,7 +27,7 @@ sub test_req_prepare_base {
ok(!$domain0->is_base,"Domain $name should not be base");
my $req = Ravada::Request->prepare_base(id_domain => $domain0->id, uid => $USER->id);
$RAVADA->_process_requests_dont_fork();
$RAVADA->_process_all_requests_dont_fork();
ok($req->status('done'),"Request should be done, it is".$req->status);
ok(!$req->error(),"Request error ".$req->error);
......
......@@ -168,10 +168,10 @@ sub test_req_prepare_base {
ok($domain->is_locked,"Domain $name should be locked when preparing base");
}
$rvd_back->process_requests();
rvd_back->process_requests();
rvd_back->process_long_requests(0,1);
wait_request($req);
ok(!$req->error,"Expecting error='', got '".($req->error or '')."'");
$rvd_back = undef;
my $vm = rvd_front()->search_vm($vm_name);
my $domain2 = $vm->search_domain($name);
......@@ -300,6 +300,7 @@ sub test_req_remove_base_fail {
ok($req->status eq 'requested' || $req->status eq 'done');
rvd_back->process_requests();
rvd_back->process_long_requests(0,1);
wait_request($req);
ok($req->status eq 'done', "Expected req->status 'done', got "
......@@ -341,6 +342,7 @@ sub test_req_remove_base {
{
my $rvd_back = rvd_back();
rvd_back->process_requests();
rvd_back->process_long_requests(0,1);
wait_request($req);
}
ok($req->status eq 'done', "[$vm_name] Expected req->status 'done', got "
......
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