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

test(request): pass ISO name to create

issue #1136
parent c6e29191
......@@ -85,7 +85,7 @@ sub test_start {
$RAVADA->_process_all_requests_dont_fork(0);
}
wait_request( background => $fork, check_error => 0 );
wait_request( background => $fork, check_error => 0, request => $req );
ok($req->status eq 'done', "[$vm_name] Req ".$req->{id}." expecting status done, got ".$req->status);
like($req->error , qr/unknown/i
......@@ -176,7 +176,7 @@ sub test_screenshot {
my $dont_fork = 1;
rvd_back->process_all_requests(0,$dont_fork);
wait_request( background=> !$dont_fork );
wait_request( background=> !$dont_fork, request => $req );
ok($req->status('done'),"Request should be done, it is ".$req->status);
ok(!$req->error(''),"Error should be '' , it is ".$req->error);
......@@ -209,7 +209,7 @@ sub test_screenshot_file {
my $dont_fork = 1;
rvd_back->process_all_requests(0,$dont_fork);
wait_request( background => !$dont_fork );
wait_request( background => !$dont_fork, request => $req );
ok($req->status('done'),"Request should be done, it is ".$req->status);
ok(!$req->error(),"Error should be '' , it is ".($req->error or ''));
......
......@@ -89,6 +89,40 @@ sub search_domain_db
return $row;
}
sub test_new_domain_iso_name {
my $active = shift;
my $domain = $RAVADA->create_domain(name => new_domain_name
, iso_name => 'Alpine %'
, active => $active
, id_owner => $USER->id
, vm => $BACKEND
, disk => 1024 * 1024
);
ok($domain,"Expecting new domain");
$domain->remove(user_admin) if $domain;
}
sub test_new_domain_iso_name_req {
my $name = new_domain_name();
my $req = Ravada::Request->create_domain
(name => $name
, iso_name => 'Alpine %'
, id_owner => $USER->id
, vm => $BACKEND
, disk => 1024 * 1024
);
wait_request(request => $req, background => 0);
my $domain = rvd_back->search_domain($name);
ok($domain,"Expecting new domain");
$domain->remove(user_admin) if $domain;
}
sub test_new_domain {
my $active = shift;
......@@ -330,6 +364,10 @@ test_vm_kvm();
remove_old_domains();
remove_old_disks();
test_new_domain_iso_name();
test_new_domain_iso_name_req();
test_domain();
test_remove_corrupt_clone($vm);
test_domain_with_iso();
......
use warnings;
use strict;
use Data::Dumper;
use Test::More;
use lib 't/lib';
use Test::Ravada;
no warnings "experimental::signatures";
use feature qw(signatures);
init();
clean();
##########################################################################
sub test_shutdown($domain) {
my $valid = Ravada::Request::valid_args('shutdown_domain');
is($valid->{machine},2);
is($valid->{name},2);
is($valid->{id_domain},2);
is($valid->{timeout},2);
my $valid_cli = Ravada::Request::valid_args_cli('shutdown');
is($valid_cli->{machine},1);
is($valid_cli->{timeout},2);
is($valid_cli->{name},2);
my $req = Ravada::Request->new_request(
'shutdown'
, machine => $domain->name
, uid => user_admin->id
);
wait_request(request => $req, background => 0);
$req = Ravada::Request->new_request(
'shutdown'
, machine => $domain->id
, uid => user_admin->id
);
wait_request(request => $req, background => 0);
$req = Ravada::Request->new_request(
'shutdown'
, name => $domain->name
, uid => user_admin->id
);
wait_request(request => $req, background => 0);
}
sub test_rename($domain) {
my $req = Ravada::Request->new_request(
'rename_domain'
, name => $domain->name."-2"
, machine => $domain->name
, uid => user_admin->id
);
wait_request(request => $req, background => 0);
}
##########################################################################
my $domain =create_domain('void');
test_shutdown($domain);
test_rename($domain);
clean();
done_testing();
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