App-ClusterSSH
view release on metacpan or search on metacpan
t/30cluster.t view on Meta::CPAN
use strict;
use warnings;
# Force use of English in tests for the moment, for those users that
# have a different locale set, since errors are hardcoded below
use POSIX qw(setlocale locale_h);
setlocale( LC_ALL, "C" );
use FindBin qw($Bin $Script);
use lib "$Bin/../lib";
use Test::More;
use Test::Trap;
use File::Which qw(which);
use English '-no_match_vars';
use Readonly;
package Test::ClusterSSH::Mock;
# generate purpose object used to simplfy testing
sub new {
my ( $class, %args ) = @_;
my $config = {%args};
return bless $config, $class;
}
sub parent {
my ($self) = @_;
return $self;
}
sub config {
my ($self) = @_;
return $self;
}
sub load_configs {
my ($self) = @_;
return $self;
}
sub config_file {
my ($self) = @_;
return {};
}
1;
package main;
BEGIN {
$ENV{PATH} = $ENV{PATH} . ':' . $Bin . '/bin';
use_ok("App::ClusterSSH::Cluster") || BAIL_OUT('failed to use module');
use_ok("App::ClusterSSH::Config") || BAIL_OUT('failed to use module');
}
my $mock_object = Test::ClusterSSH::Mock->new();
my $cluster1 = App::ClusterSSH::Cluster->new( parent => $mock_object );
isa_ok( $cluster1, 'App::ClusterSSH::Cluster' );
my $cluster2 = App::ClusterSSH::Cluster->new();
isa_ok( $cluster2, 'App::ClusterSSH::Cluster' );
my %expected = ( people => [ 'fred', 'jo', 'pete', ] );
( run in 1.105 second using v1.01-cache-2.11-cpan-ceb78f64989 )