[Nagiosplug-checkins] nagiosplug/plugins/t check_http.t,1.10,1.11

Ton Voon tonvoon at users.sourceforge.net
Thu May 25 08:36:01 CEST 2006


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

Modified Files:
	check_http.t 
Log Message:
Option to invert results from a regexp pattern match


Index: check_http.t
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/t/check_http.t,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- check_http.t	5 Apr 2006 07:58:29 -0000	1.10
+++ check_http.t	25 May 2006 15:34:54 -0000	1.11
@@ -9,7 +9,7 @@
 use Test::More;
 use NPTest;
 
-plan tests => 14;
+plan tests => 21;
 
 my $successOutput = '/OK.*HTTP.*second/';
 
@@ -79,4 +79,19 @@
 	);
 cmp_ok( $res->return_code, "==", 0, "Can read https for www.e-paycobalt.com (uses AES certificate)" );
 
-	
+$res = NPTest->testCmd( "./check_http -H altinity.com -r 'nagios'" );
+cmp_ok( $res->return_code, "==", 0, "Got a reference to 'nagios'");
+
+$res = NPTest->testCmd( "./check_http -H altinity.com -r 'nAGiOs'" );
+cmp_ok( $res->return_code, "==", 2, "Not got 'nAGiOs'");
+like ( $res->output, "/pattern not found/", "Error message says 'pattern not found'");
+
+$res = NPTest->testCmd( "./check_http -H altinity.com -R 'nAGiOs'" );
+cmp_ok( $res->return_code, "==", 0, "But case insensitive doesn't mind 'nAGiOs'");
+
+$res = NPTest->testCmd( "./check_http -H altinity.com -r 'nagios' --invert-regex" );
+cmp_ok( $res->return_code, "==", 2, "Invert results work when found");
+like ( $res->output, "/pattern found/", "Error message says 'pattern found'");
+
+$res = NPTest->testCmd( "./check_http -H altinity.com -r 'nAGiOs' --invert-regex" );
+cmp_ok( $res->return_code, "==", 0, "And also when not found");





More information about the Commits mailing list