-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path__module__.pm
68 lines (49 loc) · 999 Bytes
/
__module__.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#
# (c) Jan Gehring <jan.gehring@gmail.com>
#
# vim: set ts=2 sw=2 tw=0:
# vim: set expandtab:
=head1 NAME
TestCluster - Cluster Test Module
=head1 DESCRIPTION
This is a basic cluster test module.
=head1 EXAMPLE
=cut
package TestCluster;
use strict;
use warnings;
# VERSION
use Moose;
use TestCluster::Proxy;
require Rex::Commands::Box;
require Rex::Test::Base;
has cluster_def => (
is => 'ro',
isa => 'Str',
required => 1,
);
has vms => (
is => 'ro',
isa => 'HashRef',
writer => '_set_vms',
);
sub initialize {
my ($self) = @_;
Rex::Commands::Box->load_init_file( $self->cluster_def );
$self->_set_vms( Rex::Commands::Box::boxes("init") );
}
sub vm {
my ( $self, $name ) = @_;
my $proxy = TestCluster::Proxy->new( box => $self->vms->{$name} );
return $proxy;
}
sub finish {
my ($self) = @_;
my $tb = Rex::Test::Base->builder;
$tb->done_testing();
$tb->is_passing()
? print "PASS\n"
: print "FAIL\n";
$tb->reset();
}
1;