From: Tyler Riddle Date: Thu, 6 Sep 2012 03:32:23 +0000 (-0700) Subject: update tests so they run with new logging support X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9dae3d9060ba7b3d67f235ce924f1e1277876553;p=scpubgit%2FSystem-Introspector.git update tests so they run with new logging support --- diff --git a/t/config.t b/t/config.t index d88a1b5..9756d55 100644 --- a/t/config.t +++ b/t/config.t @@ -4,6 +4,8 @@ use FindBin; use System::Introspector::Config; +require 't/logsetup.pl'; + my $config = System::Introspector::Config->new( config_file => "$FindBin::Bin/data/test.conf", ); diff --git a/t/diskusage.t b/t/diskusage.t index d6fb426..f0581ae 100644 --- a/t/diskusage.t +++ b/t/diskusage.t @@ -3,6 +3,8 @@ use Test::More; use System::Introspector::Probe::DiskUsage; +require 't/logsetup.pl'; + my $probe = System::Introspector::Probe::DiskUsage->new; my $result = $probe->gather; diff --git a/t/filehandles.t b/t/filehandles.t index 2ed92aa..a54f2dc 100644 --- a/t/filehandles.t +++ b/t/filehandles.t @@ -4,6 +4,8 @@ use FindBin; use System::Introspector::Probe::FileHandles; +require 't/logsetup.pl'; + $ENV{PATH} = "$FindBin::Bin/bin:" . $ENV{PATH}; my $probe = System::Introspector::Probe::FileHandles->new; diff --git a/t/groups.t b/t/groups.t index dc28ec2..9b707b4 100644 --- a/t/groups.t +++ b/t/groups.t @@ -3,6 +3,8 @@ use Test::More; use System::Introspector::Probe::Groups; +require 't/logsetup.pl'; + my $probe = System::Introspector::Probe::Groups->new; my $result = $probe->gather; diff --git a/t/host.t b/t/host.t index 04ef558..748ee69 100644 --- a/t/host.t +++ b/t/host.t @@ -4,6 +4,8 @@ use FindBin; use System::Introspector::Probe::Host; +require 't/logsetup.pl'; + my $probe = System::Introspector::Probe::Host->new( hostname_file => "$FindBin::Bin/data/hostname", ); diff --git a/t/hosts.t b/t/hosts.t index a7c7a43..7c0cc67 100644 --- a/t/hosts.t +++ b/t/hosts.t @@ -4,6 +4,8 @@ use FindBin; use System::Introspector::Probe::Hosts; +require 't/logsetup.pl'; + my $probe = System::Introspector::Probe::Hosts->new( hosts_file => "$FindBin::Bin/data/hosts", ); diff --git a/t/libdirs-perl.t b/t/libdirs-perl.t index 4e7ef2c..5b669c4 100644 --- a/t/libdirs-perl.t +++ b/t/libdirs-perl.t @@ -4,6 +4,8 @@ use FindBin; use System::Introspector::Probe::LibDirs::Perl; +require 't/logsetup.pl'; + my $dir = "$FindBin::Bin/data/libdir/perl"; no warnings 'redefine'; diff --git a/t/logsetup.pl b/t/logsetup.pl new file mode 100644 index 0000000..5db31d7 --- /dev/null +++ b/t/logsetup.pl @@ -0,0 +1,5 @@ +#require this in the test to initialize the logging framewor +#so the tests can run +use System::Introspector::Logger qw( ); +System::Introspector::Logger->init_logging('WARN'); +1; \ No newline at end of file diff --git a/t/mountpoints.t b/t/mountpoints.t index e3f8859..7108835 100644 --- a/t/mountpoints.t +++ b/t/mountpoints.t @@ -3,6 +3,8 @@ use Test::More; use System::Introspector::Probe::MountPoints; +require 't/logsetup.pl'; + my $probe = System::Introspector::Probe::MountPoints->new; my $data = $probe->gather; diff --git a/t/nagios-checkmkagent.t b/t/nagios-checkmkagent.t index 77a7412..70b913f 100644 --- a/t/nagios-checkmkagent.t +++ b/t/nagios-checkmkagent.t @@ -3,6 +3,8 @@ use Test::More; use System::Introspector::Probe::Nagios::CheckMkAgent; +require 't/logsetup.pl'; + no warnings 'redefine'; *System::Introspector::Probe::Nagios::CheckMkAgent::_get_check_mk_agent_output = sub { return map "$_\n", diff --git a/t/packages-apt.t b/t/packages-apt.t index ec99aac..79386cb 100644 --- a/t/packages-apt.t +++ b/t/packages-apt.t @@ -4,6 +4,8 @@ use FindBin; use System::Introspector::Probe::Packages::Apt; +require 't/logsetup.pl'; + my $probe = System::Introspector::Probe::Packages::Apt->new; my $data = $probe->gather; diff --git a/t/perls.t b/t/perls.t index 51052d1..c885154 100644 --- a/t/perls.t +++ b/t/perls.t @@ -4,6 +4,8 @@ use FindBin; use System::Introspector::Probe::Perls; +require 't/logsetup.pl'; + do { no warnings 'redefine'; *System::Introspector::Probe::Perls::_find_possible_perl_configs = sub { diff --git a/t/processes.t b/t/processes.t index 7a41910..6653001 100644 --- a/t/processes.t +++ b/t/processes.t @@ -3,6 +3,8 @@ use Test::More; use System::Introspector::Probe::Processes; +require 't/logsetup.pl'; + my $probe = System::Introspector::Probe::Processes->new; my $result = $probe->gather; diff --git a/t/puppet.t b/t/puppet.t index 1e49879..676cb47 100644 --- a/t/puppet.t +++ b/t/puppet.t @@ -4,6 +4,8 @@ use FindBin; use System::Introspector::Probe::Puppet; +require 't/logsetup.pl'; + my $probe = System::Introspector::Probe::Puppet->new( classes_file => "$FindBin::Bin/data/puppet/classes.txt", resources_file => "$FindBin::Bin/data/puppet/resources.txt", diff --git a/t/repositories-git.t b/t/repositories-git.t index 008224d..e6c4199 100644 --- a/t/repositories-git.t +++ b/t/repositories-git.t @@ -4,6 +4,8 @@ use File::Temp qw( tempdir ); use System::Introspector::Probe::Repositories::Git; +require 't/logsetup.pl'; + plan skip_all => q{Tests require a git executable} unless `which git`; diff --git a/t/resolvconf.t b/t/resolvconf.t index 9d2d773..acecd5d 100644 --- a/t/resolvconf.t +++ b/t/resolvconf.t @@ -4,6 +4,8 @@ use FindBin; use System::Introspector::Probe::ResolvConf; +require 't/logsetup.pl'; + my $probe = System::Introspector::Probe::ResolvConf->new( resolv_conf_file => "$FindBin::Bin/data/resolv.conf", ); diff --git a/t/sudoers.t b/t/sudoers.t index d230980..4fd6bce 100644 --- a/t/sudoers.t +++ b/t/sudoers.t @@ -4,6 +4,8 @@ use FindBin; use System::Introspector::Probe::Sudoers; +require 't/logsetup.pl'; + my $dir = "$FindBin::Bin/sudoers-data"; system("mkdir $dir"); diff --git a/t/users.t b/t/users.t index efaba05..74a103d 100644 --- a/t/users.t +++ b/t/users.t @@ -4,6 +4,8 @@ use FindBin; use System::Introspector::Probe::Users; +require 't/logsetup.pl'; + my $passwd_file = "$FindBin::Bin/test-passwd"; my $home = "$FindBin::Bin/data/home-testfoo"; my $nohome = "$FindBin::Bin/data/home-doesnotexist";