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

force disable LXC and check it

parent 6bbf8e5c
package Ravada::VM::LXC;
use Carp qw(croak);
use warnings;
use strict;
use Carp qw(carp croak);
use Data::Dumper;
use Fcntl qw(:flock O_WRONLY O_EXCL O_CREAT);
use Hash::Util qw(lock_hash);
......@@ -13,12 +16,13 @@ use XML::LibXML;
with 'Ravada::VM';
our $CMD_LXC;
our $CMD_LXC_LS;
sub BUILD {
my $self = shift;
die "No LXC backend found\n" if !$CMD_LXC;
$self->connect() if !defined $CMD_LXC_LS;
die "No LXC backend found\n" if !$CMD_LXC_LS;
sub connect {
......@@ -33,12 +37,12 @@ sub connect {
return $CMD_LXC if $CMD_LXC;
return $CMD_LXC_LS if defined $CMD_LXC_LS;
$CMD_LXC = `which lxc`;
chomp $CMD_LXC;
$CMD_LXC_LS = `which lxc-ls`;
chomp $CMD_LXC_LS;
return $CMD_LXC;
return $CMD_LXC_LS;
sub create_domain {
......@@ -147,6 +147,15 @@ SKIP: {
ok(!$vm,"There should be no LXC backends");
diag("SKIPPING LXC tests: $msg");
skip $msg,10;
} else {
$Ravada::VM::LXC::CMD_LXC_LS = '';
# twice to ignore warnings
$Ravada::VM::LXC::CMD_LXC_LS = '';
diag("Testing missing LXC");
my $ravada2 = Ravada->new();
my $vm2 = $ravada2->search_vm('lxc');
ok(!$vm2,"No LXC virtual manager should be found withoud LXC_LS defined");
ok($vm,"I can't find a LXC virtual manager from ravada");
my $domain = test_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