Commit 8c33bab7 authored by Francesc Guasch's avatar Francesc Guasch
Browse files

create front and back ends for testing purposes

parent 1016158a
...@@ -5,6 +5,7 @@ use Data::Dumper; ...@@ -5,6 +5,7 @@ use Data::Dumper;
use Test::More; use Test::More;
use Test::SQL::Data; use Test::SQL::Data;
use_ok('Ravada');
use_ok('Ravada::Front'); use_ok('Ravada::Front');
my $test = Test::SQL::Data->new(config => 't/etc/ravada.conf'); my $test = Test::SQL::Data->new(config => 't/etc/ravada.conf');
...@@ -14,7 +15,7 @@ my @rvd_args = ( ...@@ -14,7 +15,7 @@ my @rvd_args = (
,connector => $test->connector ,connector => $test->connector
); );
my $RVD_BACK = Ravada->new( @rvd_args); my $RVD_BACK = Ravada->new( @rvd_args );
my $RVD_FRONT = Ravada::Front->new( @rvd_args my $RVD_FRONT = Ravada::Front->new( @rvd_args
, backend => $RVD_BACK , backend => $RVD_BACK
); );
...@@ -23,6 +24,9 @@ my $RVD_FRONT = Ravada::Front->new( @rvd_args ...@@ -23,6 +24,9 @@ my $RVD_FRONT = Ravada::Front->new( @rvd_args
ok($Ravada::CONNECTOR,"\$Ravada::Connector wasn't set"); ok($Ravada::CONNECTOR,"\$Ravada::Connector wasn't set");
ok($Ravada::CONNECTOR,"\$Ravada::Connector wasn't set"); ok($Ravada::CONNECTOR,"\$Ravada::Connector wasn't set");
ok($RVD_BACK->connector());
sub test_empty { sub test_empty {
my $bases = $RVD_FRONT->list_bases(); my $bases = $RVD_FRONT->list_bases();
......
...@@ -13,7 +13,15 @@ my $CONT= 0; ...@@ -13,7 +13,15 @@ my $CONT= 0;
my $test = Test::SQL::Data->new(config => 't/etc/ravada.conf'); my $test = Test::SQL::Data->new(config => 't/etc/ravada.conf');
my $RVD = Ravada::Front->new( connector => $test->connector); my @rvd_args = (
config => 't/etc/ravada.conf'
,connector => $test->connector
);
my $RVD_BACK = Ravada->new( @rvd_args );
my $RVD_FRONT = Ravada::Front->new( @rvd_args
, backend => $RVD_BACK
);
my %CREATE_ARGS = ( my %CREATE_ARGS = (
kvm => { id_iso => 1 } kvm => { id_iso => 1 }
...@@ -37,13 +45,13 @@ sub create_args { ...@@ -37,13 +45,13 @@ sub create_args {
for my $backend ('kvm','lxc') { for my $backend ('kvm','lxc') {
my $name = _new_name(); my $name = _new_name();
my $req = $RVD->create_domain( name => $name my $req = $RVD_FRONT->create_domain( name => $name
, backend => $backend , backend => $backend
, create_args($backend) , create_args($backend)
); );
ok($req, "Request $name not created"); ok($req, "Request $name not created");
$RVD->wait_request($req); $RVD_FRONT->wait_request($req);
ok($req->status eq 'done',"Request for create $backend domain ".$req->status); ok($req->status eq 'done',"Request for create $backend domain ".$req->status);
} }
......
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