Commit 75fa6d08 authored by Francesc Guasch's avatar Francesc Guasch
Browse files

test(backend): remove when parent gone

closes #1492
parent 23aada5a
......@@ -51,6 +51,7 @@ create_domain
start_node shutdown_node remove_node hibernate_node
start_domain_internal shutdown_domain_internal
hibernate_domain_internal
remove_domain_internal
remote_node
remote_node_2
remote_node_shared
......@@ -2007,6 +2008,16 @@ sub shutdown_domain_internal($domain) {
}
}
sub remove_domain_internal($domain) {
if ( $domain->type eq 'KVM') {
$domain->domain->undefine();
} elsif ($domain->type eq 'Void') {
unlink $domain->_config_file();
} else {
confess "I don't know how to remove ".$domain->name;
}
}
sub start_domain_internal($domain) {
if ($domain->type eq 'KVM') {
$domain->_set_spice_ip(1,$domain->_vm->ip);
......
......@@ -115,6 +115,31 @@ sub _remove_domain(@domain) {
}
}
sub test_remove_parent_already_removed($vm){
my $base = create_domain($vm->type);
$base->prepare_base(user_admin);
my $name = new_domain_name();
Ravada::Request->clone(
id_owner => user_admin->id
,uid => user_admin->id
,name => $name
,id_domain=> $base->id
);
wait_request();
my $clone = rvd_back->search_domain($name);
remove_domain_internal($base);
my $req = Ravada::Request->remove_domain(
uid => user_admin->id
,name => $clone->name
);
wait_request();
is($req->status,'done');
is($req->error, '');
my $clone2 = rvd_back->search_domain($name);
ok(!$clone2);
remove_domain($base);
}
##############################################################################
clean();
......@@ -138,6 +163,7 @@ for my $vm_name ( vm_names() ) {
diag("Testing remove on $vm_name");
test_remove_parent_already_removed($vm);
test_remove_rename($vm);
test_remove_domain($vm);
test_remove_domain_volumes_already_gone($vm);
......
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