diff options
Diffstat (limited to 'plugins/tests')
-rwxr-xr-x | plugins/tests/check_http.t | 8 | ||||
-rwxr-xr-x | plugins/tests/check_snmp.t | 11 |
2 files changed, 14 insertions, 5 deletions
diff --git a/plugins/tests/check_http.t b/plugins/tests/check_http.t index 225b449f..d93a0ecf 100755 --- a/plugins/tests/check_http.t +++ b/plugins/tests/check_http.t | |||
@@ -186,21 +186,21 @@ SKIP: { | |||
186 | 186 | ||
187 | $result = NPTest->testCmd( "$command -p $port_https -S -C 14" ); | 187 | $result = NPTest->testCmd( "$command -p $port_https -S -C 14" ); |
188 | is( $result->return_code, 0, "$command -p $port_https -S -C 14" ); | 188 | is( $result->return_code, 0, "$command -p $port_https -S -C 14" ); |
189 | is( $result->output, 'OK - Certificate \'Ton Voon\' will expire on 03/03/2019 21:41.', "output ok" ); | 189 | is( $result->output, 'OK - Certificate \'Ton Voon\' will expire on Sun Mar 3 21:41:00 2019.', "output ok" ); |
190 | 190 | ||
191 | $result = NPTest->testCmd( "$command -p $port_https -S -C 14000" ); | 191 | $result = NPTest->testCmd( "$command -p $port_https -S -C 14000" ); |
192 | is( $result->return_code, 1, "$command -p $port_https -S -C 14000" ); | 192 | is( $result->return_code, 1, "$command -p $port_https -S -C 14000" ); |
193 | like( $result->output, '/WARNING - Certificate \'Ton Voon\' expires in \d+ day\(s\) \(03/03/2019 21:41\)./', "output ok" ); | 193 | like( $result->output, '/WARNING - Certificate \'Ton Voon\' expires in \d+ day\(s\) \(Sun Mar 3 21:41:00 2019\)./', "output ok" ); |
194 | 194 | ||
195 | # Expired cert tests | 195 | # Expired cert tests |
196 | $result = NPTest->testCmd( "$command -p $port_https -S -C 13960,14000" ); | 196 | $result = NPTest->testCmd( "$command -p $port_https -S -C 13960,14000" ); |
197 | is( $result->return_code, 2, "$command -p $port_https -S -C 13960,14000" ); | 197 | is( $result->return_code, 2, "$command -p $port_https -S -C 13960,14000" ); |
198 | like( $result->output, '/CRITICAL - Certificate \'Ton Voon\' expires in \d+ day\(s\) \(03/03/2019 21:41\)./', "output ok" ); | 198 | like( $result->output, '/CRITICAL - Certificate \'Ton Voon\' expires in \d+ day\(s\) \(Sun Mar 3 21:41:00 2019\)./', "output ok" ); |
199 | 199 | ||
200 | $result = NPTest->testCmd( "$command -p $port_https_expired -S -C 7" ); | 200 | $result = NPTest->testCmd( "$command -p $port_https_expired -S -C 7" ); |
201 | is( $result->return_code, 2, "$command -p $port_https_expired -S -C 7" ); | 201 | is( $result->return_code, 2, "$command -p $port_https_expired -S -C 7" ); |
202 | is( $result->output, | 202 | is( $result->output, |
203 | 'CRITICAL - Certificate \'Ton Voon\' expired on 03/05/2009 00:13.', | 203 | 'CRITICAL - Certificate \'Ton Voon\' expired on Thu Mar 5 00:13:00 2009.', |
204 | "output ok" ); | 204 | "output ok" ); |
205 | 205 | ||
206 | } | 206 | } |
diff --git a/plugins/tests/check_snmp.t b/plugins/tests/check_snmp.t index aace9bcc..2fd033d2 100755 --- a/plugins/tests/check_snmp.t +++ b/plugins/tests/check_snmp.t | |||
@@ -20,7 +20,16 @@ if ($@) { | |||
20 | plan skip_all => "Missing required module for test: $@"; | 20 | plan skip_all => "Missing required module for test: $@"; |
21 | } else { | 21 | } else { |
22 | if (-x "./check_snmp") { | 22 | if (-x "./check_snmp") { |
23 | plan tests => $tests; | 23 | # check if snmpd has perl support |
24 | my $test = `snmpd -c tests/conf/snmpd.conf -C -r -H 2>&1`; | ||
25 | if(!defined $test) { | ||
26 | plan skip_all => "snmpd required"; | ||
27 | } | ||
28 | elsif($test =~ m/Warning: Unknown token: perl/) { | ||
29 | plan skip_all => "snmpd has no perl support"; | ||
30 | } else { | ||
31 | plan tests => $tests; | ||
32 | } | ||
24 | } else { | 33 | } else { |
25 | plan skip_all => "No check_snmp compiled"; | 34 | plan skip_all => "No check_snmp compiled"; |
26 | } | 35 | } |