Commit 844ed1ca authored by Francesc Guasch's avatar Francesc Guasch
Browse files

[#169] Skip KVM tests when no KVM installed

parent 9a650101
......@@ -15,7 +15,6 @@ use Sys::Statistics::Linux;
my $BACKEND = 'KVM';
use_ok('Ravada');
use_ok("Ravada::Domain::$BACKEND");
my $test = Test::SQL::Data->new( config => 't/etc/sql.conf');
my $RVD_BACK = rvd_back( $test->connector , 't/etc/ravada.conf');
......@@ -85,6 +84,8 @@ SKIP: {
diag($msg) if !$vm;
skip $msg,10 if !$vm;
use_ok("Ravada::Domain::$BACKEND");
my $freemem = _check_free_memory();
my $n_domains = int($freemem)+2;
......
......@@ -96,7 +96,6 @@ for my $vm_name (reverse sort @VMS) {
diag("Testing $vm_name VM");
my $CLASS= "Ravada::VM::$vm_name";
use_ok($CLASS);
my $RAVADA;
eval { $RAVADA = Ravada->new(@ARG_RVD) };
......@@ -115,6 +114,8 @@ for my $vm_name (reverse sort @VMS) {
diag($msg) if !$vm;
skip $msg,10 if !$vm;
use_ok($CLASS);
my $domain = test_create_domain($vm_name);
test_list_domains($vm_name, $domain);
$domain->remove($USER);
......
......@@ -16,7 +16,6 @@ my %CONFIG = (
);
use_ok('Ravada');
use_ok($CLASS);
##########################################################
......@@ -55,6 +54,8 @@ SKIP: {
diag($err) if !$vm;
skip $msg,10 if !$vm;
use_ok($CLASS);
test_vm_connect();
test_search_vm();
......
......@@ -12,7 +12,6 @@ use Test::Ravada;
my $BACKEND = 'KVM';
use_ok('Ravada');
use_ok("Ravada::Domain::$BACKEND");
my $test = Test::SQL::Data->new( config => 't/etc/sql.conf');
......@@ -256,6 +255,8 @@ SKIP: {
diag($msg) if !$vm;
skip $msg,10 if !$vm;
use_ok("Ravada::Domain::$BACKEND");
test_vm_kvm();
remove_old_domains();
......
......@@ -14,7 +14,6 @@ use Test::Ravada;
my $BACKEND = 'KVM';
use_ok('Ravada');
use_ok("Ravada::Domain::$BACKEND");
my $test = Test::SQL::Data->new( config => 't/etc/sql.conf');
......@@ -276,6 +275,8 @@ SKIP: {
diag($msg) if !$vm;
skip $msg,10 if !$vm;
use_ok("Ravada::Domain::$BACKEND");
test_vm_kvm();
test_remove_domain($DOMAIN_NAME);
test_remove_domain($DOMAIN_NAME_SON);
......
......@@ -10,7 +10,6 @@ use lib 't/lib';
use Test::Ravada;
use_ok('Ravada');
use_ok('Ravada::Domain::KVM');
my $test = Test::SQL::Data->new( config => 't/etc/sql.conf');
my $VMM;
......@@ -54,6 +53,7 @@ SKIP: {
diag($msg) if !$VMM;
skip $msg,10 if !$VMM;
use_ok('Ravada::Domain::KVM');
my $name = new_domain_name();
......
......@@ -13,7 +13,7 @@ SKIP: {
for my $type ( qw(VM Domain ) ){
Test::Pod::Coverage::pod_coverage_ok( "Ravada::$type"
, "Ravada::$type is covered" );
for my $backend (qw(KVM )) {
for my $backend (keys %Ravada::VALID_VM ) {
Test::Pod::Coverage::pod_coverage_ok( "Ravada::$type::$backend"
, "Ravada::$type::$backend is covered" );
}
......
......@@ -319,7 +319,6 @@ for my $vm_name (qw( Void KVM )) {
diag("Testing $vm_name VM");
my $CLASS= "Ravada::VM::$vm_name";
use_ok($CLASS) or next;
my $RAVADA;
eval { $RAVADA = Ravada->new(@ARG_RVD) };
......@@ -338,6 +337,7 @@ for my $vm_name (qw( Void KVM )) {
diag($msg) if !$vm;
skip $msg,10 if !$vm;
use_ok($CLASS) or next;
test_vm_connect($vm_name);
test_search_vm($vm_name);
......
......@@ -329,7 +329,6 @@ for my $vm_name (reverse sort @VMS) {
diag("Testing $vm_name VM");
my $CLASS= "Ravada::VM::$vm_name";
use_ok($CLASS);
my $RAVADA;
eval { $RAVADA = Ravada->new(@ARG_RVD) };
......@@ -348,6 +347,8 @@ for my $vm_name (reverse sort @VMS) {
diag($msg) if !$vm;
skip $msg,10 if !$vm;
use_ok($CLASS);
my $domain = test_create_domain($vm_name);
test_prepare_base($vm_name, $domain);
test_prepare_base_active($vm_name);
......
......@@ -174,8 +174,6 @@ for my $vm_name (@VMS) {
diag("Testing $vm_name VM");
my $CLASS= "Ravada::VM::$vm_name";
use_ok($CLASS);
my $RAVADA;
eval { $RAVADA = Ravada->new(@ARG_RVD) };
......@@ -193,6 +191,8 @@ for my $vm_name (@VMS) {
diag($msg) if !$vm;
skip $msg,10 if !$vm;
use_ok($CLASS);
test_remove_domain($vm_name);
test_remove_domain_base($vm_name);
test_dont_remove_father($vm_name);
......
......@@ -91,9 +91,6 @@ $Data::Dumper::Sortkeys = 1;
for my $vm_name (qw( Void KVM )) {
diag("Testing $vm_name VM");
my $CLASS= "Ravada::VM::$vm_name";
use_ok($CLASS) or next;
my $ravada;
eval { $ravada = Ravada->new(@ARG_RVD) };
......@@ -111,6 +108,8 @@ for my $vm_name (qw( Void KVM )) {
diag($msg) if !$vm;
skip $msg,10 if !$vm;
use_ok("Ravada::VM::$vm_name");
my $domain = test_create_domain($vm_name);
$domain->start($USER);
my $info = $domain->get_info();
......
......@@ -202,7 +202,7 @@ for my $vm_name (qw( Void KVM )) {
my $vm_ok;
eval {
my $vm = rvd_front()->search_vm($vm_name);
my $vm = rvd_back()->search_vm($vm_name);
$vm_ok = 1 if $vm;
};
diag($@) if $@;
......
......@@ -264,9 +264,6 @@ $Data::Dumper::Sortkeys = 1;
for my $vm_name (qw( Void KVM )) {
diag("Testing $vm_name VM");
my $CLASS= "Ravada::VM::$vm_name";
use_ok($CLASS) or next;
my $vm_ok;
eval {
......@@ -286,6 +283,8 @@ for my $vm_name (qw( Void KVM )) {
diag($msg) if !$vm_ok;
skip $msg,10 if !$vm_ok;
use_ok("Ravada::VM::$vm_name");
test_args($vm_name);
test_small($vm_name);
};
......
......@@ -115,11 +115,7 @@ for my $vm_name (reverse sort @VMS) {
diag("Testing $vm_name VM") if $vm_name !~ /Void/i;
my $CLASS= "Ravada::VM::$vm_name";
use_ok($CLASS);
my $vm;
eval { $vm = $RVD_BACK->search_vm($vm_name) } if $RVD_BACK;
SKIP: {
......@@ -131,6 +127,7 @@ for my $vm_name (reverse sort @VMS) {
diag($msg) if !$vm;
skip $msg,10 if !$vm;
use_ok("Ravada::VM::$vm_name");
my $domain = test_create_domain($vm_name);
eval { $domain->start($USER) if !$domain->is_active() };
is($@,'');
......
......@@ -168,9 +168,6 @@ remove_old_disks();
for my $vm_name (qw( Void KVM )) {
diag("Testing $vm_name VM");
my $CLASS= "Ravada::VM::$vm_name";
use_ok($CLASS) or next;
my $vm;
eval { $vm = $RVD_BACK->search_vm($vm_name) };
......@@ -186,6 +183,8 @@ for my $vm_name (qw( Void KVM )) {
diag($msg) if !$vm;
skip $msg,10 if !$vm;
use_ok("Ravada::VM::$vm_name");
flush_rules();
my $domain = test_create_domain($vm_name);
......
......@@ -228,9 +228,6 @@ remove_old_disks();
for my $vm_name (qw( Void KVM )) {
diag("Testing $vm_name VM");
my $CLASS= "Ravada::VM::$vm_name";
use_ok($CLASS) or next;
my $vm_ok;
eval {
......@@ -249,6 +246,8 @@ for my $vm_name (qw( Void KVM )) {
diag($msg) if !$vm_ok;
skip $msg,10 if !$vm_ok;
use_ok("Ravada::VM::$vm_name");
flush_rules();
my $domain_name = test_create_domain($vm_name);
......
......@@ -147,9 +147,6 @@ remove_old_disks();
for my $vm_name (reverse sort @VMS) {
diag("Testing $vm_name VM");
my $CLASS= "Ravada::VM::$vm_name";
use_ok($CLASS);
my $RAVADA;
eval { $RAVADA = Ravada->new(@ARG_RVD) };
......@@ -168,6 +165,7 @@ for my $vm_name (reverse sort @VMS) {
diag($msg) if !$vm;
skip $msg,10 if !$vm;
use_ok("Ravada::VM::$vm_name");
my $domain = test_create_domain($vm_name);
test_prepare_base($vm_name, $domain);
my $domain_clone = test_clone($vm_name, $domain);
......
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