Commit 6372717d authored by frankiejol's avatar frankiejol
Browse files

test(backend): check volatile clones

parent 466de1c5
......@@ -151,7 +151,7 @@ sub _set_first_time_run($self) {
if ( keys %$info ) {
$FIRST_TIME_RUN = 0;
} else {
print "Installing ";
print "Installing " if $0 !~ /\.t$/;
}
}
......
......@@ -2417,6 +2417,7 @@ sub clones($self, %filter) {
my $query =
"SELECT id, id_vm, name, id_owner, status, client_status, is_pool, is_base"
." ,is_volatile "
." FROM domains "
." WHERE id_base = ? ";
my @values = ($self->id);
......
......@@ -11,7 +11,6 @@ sql:
- ../../sql/sqlite/domain_ports.sql
- ../../sql/data/insert_lxc_templates.sql
- ../../sql/data/insert_networks.sql
- ../../sql/sqlite/file_base_images.sql
- ../../sql/sqlite/domain_drivers_options.sql
- ../../sql/sqlite/domain_drivers_types.sql
- ../../sql/data/insert_domain_drivers_options.sql
......
......@@ -6,6 +6,9 @@ use Data::Dumper;
use POSIX qw(WNOHANG);
use Test::More;
no warnings "experimental::signatures";
use feature qw(signatures);
use_ok('Ravada');
use lib 't/lib';
......@@ -430,6 +433,31 @@ sub test_ips {
$vm->public_ip($public_ip);
}
sub test_req_volatile($vm) {
my $base = create_domain($vm);
$base->prepare_base(user_admin);
for my $set_volatile ( 1,0 ) {
$base->volatile_clones($set_volatile);
for my $volatile ( 0,1 ) {
my $req = Ravada::Request->clone(
id_domain => $base->id
,number => 3
,volatile => $volatile
,uid => user_admin->id
);
wait_request();
for my $clone ( $base->clones ) {
is($clone->{is_volatile}, $volatile
, "Expecting ".$clone->{name}." base_volatile=$set_volatile volatile=$volatile") or exit;
Ravada::Request->remove_domain(name => $clone->{name}
,uid => user_admin->id
);
}
}
}
remove_domain_and_clones_req($base,1,1);
}
######################################################################3
clean();
......@@ -446,6 +474,8 @@ for my $vm_name ( vm_names() ) {
skip($msg,10) if !$vm;
diag("Testing volatile clones for $vm_name");
test_req_volatile($vm);
test_ips($vm);
test_volatile_clone_req($vm);
......
Markdown is supported
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