Commit b77b80dd authored by Francesc Guasch's avatar Francesc Guasch
Browse files

refactor(test): remaining tests that failed without root

parent 88f98d8d
......@@ -4,6 +4,7 @@ use strict;
use Carp qw(confess);
use Data::Dumper;
use File::Copy;
use File::Path qw(make_path);
use IPC::Run3 qw(run3);
use Test::More;
use YAML qw(Dump Load);
......@@ -239,6 +240,7 @@ sub test_raw($vm, $swap = 0) {
$file .= ".SWAP" if $swap;
$file .= ".raw";
make_path($vm->dir_img) if ! -e $vm->dir_img;
my @cmd = ("qemu-img","create","-f","raw",$file,"1M");
my ($in, $out, $err);
run3(\@cmd,\$in, \$out, \$err);
......
......@@ -452,13 +452,14 @@ for my $vm_name ('KVM', 'Void') {
my $vm = rvd_back->search_vm($vm_name);
SKIP: {
my $fly_config;
my $msg = "SKIPPED: No virtual managers found";
if ($vm && $vm_name =~ /kvm/i && $>) {
$msg = "SKIPPED: Test must run as root";
$vm = undef;
} else {
my $fly_config = init_ldap_config();
$fly_config = init_ldap_config();
init($fly_config);
}
my $ldap;
......@@ -492,10 +493,12 @@ for my $vm_name ('KVM', 'Void') {
test_access_by_attribute_move($vm);
test_access_by_attribute_move_removed($vm);
unlink $fly_config;
}
}
clean();
done_testing();
......@@ -930,8 +930,17 @@ add_network_10(0);
test_can_expose_ports();
for my $vm_name ( 'KVM', 'Void' ) {
SKIP: {
my $vm = rvd_back->search_vm($vm_name);
next if !$vm;
my $msg = "SKIPPED test: No $vm_name VM found ";
if ($vm && $>) {
$msg = "SKIPPED: Test must run as root";
$vm = undef;
}
diag($msg) if !$vm;
skip $msg,10 if !$vm;
diag("Testing $vm_name");
test_clone_exports_add_ports($vm);
......@@ -957,6 +966,7 @@ for my $vm_name ( 'KVM', 'Void' ) {
test_clone_exports($vm);
}; # of SKIP
}
flush_rules();
......
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