summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b298721)
raw | patch | inline | side by side (parent: b298721)
author | Ton Voon <tonvoon@users.sourceforge.net> | |
Wed, 19 Apr 2006 09:33:44 +0000 (09:33 +0000) | ||
committer | Ton Voon <tonvoon@users.sourceforge.net> | |
Wed, 19 Apr 2006 09:33:44 +0000 (09:33 +0000) |
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1382 f882894a-f735-0410-b71e-b25c423dba1c
plugins/t/check_nagios.t | patch | blob | history |
index 7722071da945bf96ebce6bc55724f4d1a83d8c63..bdb444f499726d42282c286ec6ba6513c6301a34 100644 (file)
--- a/plugins/t/check_nagios.t
+++ b/plugins/t/check_nagios.t
my $result;
+# Did use init, but MacOSX 10.4 replaces init with launchd
+# Alternative is to insist that nagios is running to run this test
+# Reasonable to expect cron because build servers will
+# invoke cron to run a build
+my $procname = "cron";
+
$result = NPTest->testCmd(
- "./check_nagios -F $nagios1 -e 5 -C init"
+ "./check_nagios -F $nagios1 -e 5 -C $procname"
);
cmp_ok( $result->return_code, '==', 1, "Log over 5 minutes old" );
like ( $result->output, $warningOutput, "Output for warning correct" );
system( "perl -pe 's/1133537544/$now/' $nagios1 > $nagios1.tmp" ) == 0 or die "Problem with munging $nagios1";
$result = NPTest->testCmd(
- "./check_nagios -F $nagios1.tmp -e 1 -C init"
+ "./check_nagios -F $nagios1.tmp -e 1 -C $procname"
);
cmp_ok( $result->return_code, "==", 0, "Log up to date" );
like ( $result->output, $successOutput, "Output for success correct" );
system( "perl -pe 's/1133537544/$later/' $nagios1 > $nagios1.tmp" ) == 0 or die "Problem with munging $nagios1";
$result = NPTest->testCmd(
- "./check_nagios -F $nagios1.tmp -e 1 -C init"
+ "./check_nagios -F $nagios1.tmp -e 1 -C $procname"
);
cmp_ok( $result->return_code, "==", 1, "Log correctly seen as over 1 minute old" );
my ($age) = ($_ = $result->output) =~ /status log updated (\d+) seconds ago/;
like ( $result->output, $failureOutput, "Output for failure correct" );
$result = NPTest->testCmd(
- "./check_nagios -F $nagios2 -e 5 -C init"
+ "./check_nagios -F $nagios2 -e 5 -C $procname"
);
cmp_ok( $result->return_code, "==", 1, "Nagios2 for logfile over 5 mins old" );
system( "perl -pe 's/1133537302/$now/' $nagios2 > $nagios2.tmp" ) == 0 or die "Problem with munging $nagios2";
$result = NPTest->testCmd(
- "./check_nagios -F $nagios2.tmp -e 1 -C init"
+ "./check_nagios -F $nagios2.tmp -e 1 -C $procname"
);
cmp_ok( $result->return_code, "==", 0, "Nagios2 log up to date" );
system( "perl -pe 's/1133537302/$later/' $nagios2 > $nagios2.tmp" ) == 0 or die "Problem with munging $nagios2";
$result = NPTest->testCmd(
- "./check_nagios -F $nagios2.tmp -e 1 -C init"
+ "./check_nagios -F $nagios2.tmp -e 1 -C $procname"
);
cmp_ok( $result->return_code, "==", 1, "Nagios2 log correctly seen as over 1 minute old" );
($age) = ($_ = $result->output) =~ /status log updated (\d+) seconds ago/;
like( $age, '/^6[0-9]$/', "Log correctly seen as between 60-69 seconds old" );
$result = NPTest->testCmd(
- "./check_nagios -F t/check_nagios.t -e 1 -C init"
+ "./check_nagios -F t/check_nagios.t -e 1 -C $procname"
);
cmp_ok( $result->return_code, "==", 2, "Invalid log file" );