Skip to content

Commit

Permalink
[UPC#347] test no cd domain
Browse files Browse the repository at this point in the history
  • Loading branch information
frankiejol committed Sep 27, 2017
1 parent 9f74ef7 commit f8b600a
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions t/vm/10_domain.t
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,46 @@ sub test_description {
my $domain2 = rvd_back->search_domain($domain->name);
is($domain2->description, $description) or exit;
}

sub test_create_domain_nocd {
my $vm_name = shift;

my $vm = rvd_back->search_vm($vm_name);
my $name = new_domain_name();

my $id_iso = search_id_iso('Debian');
my $iso;
eval { $iso = $vm->_search_iso($id_iso,'<NONE>')};
return if $@ && $@ =~ /Can't locate object method/;
is($@,'');

ok(!$iso->{device},"Expecting no device. Got: "
.($iso->{device} or '<UNDEF>')) or return;

my $domain;
eval { $domain = rvd_back->search_vm($vm_name)->create_domain(
name => $name
,id_iso => $id_iso
,id_owner => $USER->id
,iso_file => '<NONE>'
);};
is($@,'');
ok($domain,"Expecting a domain");

my $iso2 = select_iso($id_iso);
is($iso->{id}, $iso2->{id}) or return;
ok(!$iso2->{device},"Expecting no device. Got: "
.($iso2->{device} or '<UNDEF>'));
}

sub select_iso {
my $id = shift;
my $sth = $test->connector->dbh->prepare("SELECT * FROM iso_images"
." WHERE id=?");
$sth->execute($id);
return $sth->fetchrow_hashref;
}

#######################################################

remove_old_domains();
Expand Down Expand Up @@ -365,6 +405,8 @@ for my $vm_name (qw( Void KVM )) {
test_vm_connect($vm_name);
test_search_vm($vm_name);

test_create_domain_nocd($vm_name);

my $domain = test_create_domain($vm_name);
test_open($vm_name, $domain);

Expand Down Expand Up @@ -398,6 +440,7 @@ for my $vm_name (qw( Void KVM )) {
test_shutdown_paused_domain($vm_name, $domain);

test_remove_domain($vm_name, $domain);

};
}
remove_old_domains();
Expand Down

0 comments on commit f8b600a

Please sign in to comment.