summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xplugins/tests/check_http.t18
1 files changed, 8 insertions, 10 deletions
diff --git a/plugins/tests/check_http.t b/plugins/tests/check_http.t
index 0eb3f05..9f97abd 100755
--- a/plugins/tests/check_http.t
+++ b/plugins/tests/check_http.t
@@ -12,7 +12,6 @@
12# Common Name (eg, YOUR name) []:Ton Voon 12# Common Name (eg, YOUR name) []:Ton Voon
13# Email Address []:tonvoon@mac.com 13# Email Address []:tonvoon@mac.com
14 14
15
16use strict; 15use strict;
17use Test::More; 16use Test::More;
18use NPTest; 17use NPTest;
@@ -160,9 +159,9 @@ sub run_server {
160 } 159 }
161} 160}
162 161
163END { 162END {
164 foreach my $pid (@pids) { 163 foreach my $pid (@pids) {
165 if ($pid) { print "Killing $pid\n"; kill "INT", $pid } 164 if ($pid) { print "Killing $pid\n"; kill "INT", $pid }
166 } 165 }
167}; 166};
168 167
@@ -179,7 +178,7 @@ run_common_tests( { command => "$command -p $port_http" } );
179SKIP: { 178SKIP: {
180 skip "HTTP::Daemon::SSL not installed", $common_tests + $ssl_only_tests if ! exists $servers->{https}; 179 skip "HTTP::Daemon::SSL not installed", $common_tests + $ssl_only_tests if ! exists $servers->{https};
181 run_common_tests( { command => "$command -p $port_https", ssl => 1 } ); 180 run_common_tests( { command => "$command -p $port_https", ssl => 1 } );
182 181
183 $result = NPTest->testCmd( "$command -p $port_https -S -C 14" ); 182 $result = NPTest->testCmd( "$command -p $port_https -S -C 14" );
184 is( $result->return_code, 0, "$command -p $port_https -S -C 14" ); 183 is( $result->return_code, 0, "$command -p $port_https -S -C 14" );
185 is( $result->output, 'OK - Certificate \'Ton Voon\' will expire on 03/03/2019 21:41.', "output ok" ); 184 is( $result->output, 'OK - Certificate \'Ton Voon\' will expire on 03/03/2019 21:41.', "output ok" );
@@ -188,14 +187,14 @@ SKIP: {
188 is( $result->return_code, 1, "$command -p $port_https -S -C 14000" ); 187 is( $result->return_code, 1, "$command -p $port_https -S -C 14000" );
189 like( $result->output, '/WARNING - Certificate \'Ton Voon\' expires in \d+ day\(s\) \(03/03/2019 21:41\)./', "output ok" ); 188 like( $result->output, '/WARNING - Certificate \'Ton Voon\' expires in \d+ day\(s\) \(03/03/2019 21:41\)./', "output ok" );
190 189
191 $result = NPTest->testCmd( "$command -p $port_https -S -C 13960,14000" );
192 is( $result->return_code, 2, "$command -p $port_https -S -C 13960,14000" );
193 like( $result->output, '/CRITICAL - Certificate \'Ton Voon\' expires in \d+ day\(s\) \(03/03/2019 21:41\)./', "output ok" );
194
195 # Expired cert tests 190 # Expired cert tests
191 $result = NPTest->testCmd( "$command -p $port_https -S -C 13960,14000" );
192 is( $result->return_code, 2, "$command -p $port_https -S -C 13960,14000" );
193 like( $result->output, '/CRITICAL - Certificate \'Ton Voon\' expires in \d+ day\(s\) \(03/03/2019 21:41\)./', "output ok" );
194
196 $result = NPTest->testCmd( "$command -p $port_https_expired -S -C 7" ); 195 $result = NPTest->testCmd( "$command -p $port_https_expired -S -C 7" );
197 is( $result->return_code, 2, "$command -p $port_https_expired -S -C 7" ); 196 is( $result->return_code, 2, "$command -p $port_https_expired -S -C 7" );
198 is( $result->output, 197 is( $result->output,
199 'CRITICAL - Certificate \'Ton Voon\' expired on 03/05/2009 00:13.', 198 'CRITICAL - Certificate \'Ton Voon\' expired on 03/05/2009 00:13.',
200 "output ok" ); 199 "output ok" );
201 200
@@ -406,4 +405,3 @@ sub run_common_tests {
406 isnt( $@, "alarm\n", $cmd ); 405 isnt( $@, "alarm\n", $cmd );
407 406
408} 407}
409