diff options
author | Ton Voon <tonvoon@users.sourceforge.net> | 2006-05-25 15:34:54 +0000 |
---|---|---|
committer | Ton Voon <tonvoon@users.sourceforge.net> | 2006-05-25 15:34:54 +0000 |
commit | fbf2154c5a68915dc6197e7a2ff56e56ef924220 (patch) | |
tree | 9092d9452f4e4d310a746ccdde7d14adf7374fe5 /plugins/t | |
parent | 5fd2550d4c96318b2de4a4a44e15e3c50c268e79 (diff) | |
download | monitoring-plugins-fbf2154c5a68915dc6197e7a2ff56e56ef924220.tar.gz |
Option to invert results from a regexp pattern match
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1404 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/t')
-rw-r--r-- | plugins/t/check_http.t | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/plugins/t/check_http.t b/plugins/t/check_http.t index 3154151f..4e3c06cb 100644 --- a/plugins/t/check_http.t +++ b/plugins/t/check_http.t | |||
@@ -9,7 +9,7 @@ use strict; | |||
9 | use Test::More; | 9 | use Test::More; |
10 | use NPTest; | 10 | use NPTest; |
11 | 11 | ||
12 | plan tests => 14; | 12 | plan tests => 21; |
13 | 13 | ||
14 | my $successOutput = '/OK.*HTTP.*second/'; | 14 | my $successOutput = '/OK.*HTTP.*second/'; |
15 | 15 | ||
@@ -79,4 +79,19 @@ $res = NPTest->testCmd( | |||
79 | ); | 79 | ); |
80 | cmp_ok( $res->return_code, "==", 0, "Can read https for www.e-paycobalt.com (uses AES certificate)" ); | 80 | cmp_ok( $res->return_code, "==", 0, "Can read https for www.e-paycobalt.com (uses AES certificate)" ); |
81 | 81 | ||
82 | 82 | $res = NPTest->testCmd( "./check_http -H altinity.com -r 'nagios'" ); | |
83 | cmp_ok( $res->return_code, "==", 0, "Got a reference to 'nagios'"); | ||
84 | |||
85 | $res = NPTest->testCmd( "./check_http -H altinity.com -r 'nAGiOs'" ); | ||
86 | cmp_ok( $res->return_code, "==", 2, "Not got 'nAGiOs'"); | ||
87 | like ( $res->output, "/pattern not found/", "Error message says 'pattern not found'"); | ||
88 | |||
89 | $res = NPTest->testCmd( "./check_http -H altinity.com -R 'nAGiOs'" ); | ||
90 | cmp_ok( $res->return_code, "==", 0, "But case insensitive doesn't mind 'nAGiOs'"); | ||
91 | |||
92 | $res = NPTest->testCmd( "./check_http -H altinity.com -r 'nagios' --invert-regex" ); | ||
93 | cmp_ok( $res->return_code, "==", 2, "Invert results work when found"); | ||
94 | like ( $res->output, "/pattern found/", "Error message says 'pattern found'"); | ||
95 | |||
96 | $res = NPTest->testCmd( "./check_http -H altinity.com -r 'nAGiOs' --invert-regex" ); | ||
97 | cmp_ok( $res->return_code, "==", 0, "And also when not found"); | ||