[Nagiosplug-checkins] nagiosplug/plugins/t check_nagios.t,1.1,1.2

Ton Voon tonvoon at users.sourceforge.net
Wed Apr 19 02:34:08 CEST 2006


Update of /cvsroot/nagiosplug/nagiosplug/plugins/t
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24082/t

Modified Files:
	check_nagios.t 
Log Message:
Fix check_nagios tests on MacOSX 10.4


Index: check_nagios.t
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/t/check_nagios.t,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- check_nagios.t	2 Dec 2005 22:28:06 -0000	1.1
+++ check_nagios.t	19 Apr 2006 09:33:44 -0000	1.2
@@ -18,8 +18,14 @@
 
 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" );
@@ -29,7 +35,7 @@
 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" );
@@ -38,7 +44,7 @@
 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/;
@@ -51,7 +57,7 @@
 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" );
 
@@ -59,7 +65,7 @@
 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" );
 
@@ -67,14 +73,14 @@
 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" );
 





More information about the Commits mailing list