Commit 348a6288 authored by Francesc Guasch's avatar Francesc Guasch
Browse files

create bases from requests works now

parent 9e55ee7d
......@@ -292,8 +292,14 @@ sub _cmd_create {
my $self = shift;
my $request = shift;
$request->status('working');
eval { $self->create_domain(%{$request->args}) };
$request->status('creating domain');
my $domain;
eval {$domain = $self->create_domain(%{$request->args}) };
if ($request->args('is_base') ) {
$request->status('preparing base');
$domain->prepare_base();
}
$request->status('done');
$request->error($@);
......
......@@ -265,6 +265,7 @@ sub req_new_base {
my $req = Ravada::Request->create_domain(
name => $name
,id_iso => $c->param('id_iso')
,is_base => 1
);
wait_request_done($c,$req);
......
......@@ -69,6 +69,38 @@ sub test_req_create_domain_iso {
return $domain;
}
sub test_req_create_base {
my $name = $DOMAIN_NAME."_base";
my $req = Ravada::Request->create_domain(
name => $name
,id_iso => 1
,is_base => 1
);
ok($req);
ok($req->status);
ok(defined $req->args->{name}
&& $req->args->{name} eq $name
,"Expecting args->{name} eq $name "
." ,got '".($req->args->{name} or '<UNDEF>')."'");
ok($req->status eq 'requested'
,"Status of request is ".$req->status." it should be requested");
$ravada->process_requests();
ok($req->status eq 'done'
,"Status of request is ".$req->status." it should be done");
ok(!$req->error,"Error ".$req->error." creating domain ".$name);
my $domain = $ravada->search_domain($name);
ok($domain,"I can't find domain $name");
ok($domain && $domain->is_base,"Domain $name should be base");
return $domain;
}
sub test_req_remove_domain_obj {
my $domain = shift;
......@@ -109,6 +141,12 @@ test_remove_domain($DOMAIN_NAME."_iso");
test_req_remove_domain_name($domain->name) if $domain;
}
{
my $domain = test_req_create_base();
test_req_remove_domain_name($domain->name) if $domain;
}
test_remove_domain($DOMAIN_NAME."_iso");
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