mirror of
https://github.com/monitoring-plugins/monitoring-plugins.git
synced 2026-05-28 04:35:40 -04:00
merge test changes from check_http
the example certificate has changed since.
This commit is contained in:
parent
072e97d5de
commit
d54f14a092
1 changed files with 11 additions and 10 deletions
|
|
@ -4,13 +4,15 @@
|
|||
#
|
||||
# To create the https server certificate:
|
||||
# openssl req -new -x509 -keyout server-key.pem -out server-cert.pem -days 3650 -nodes
|
||||
# Country Name (2 letter code) [AU]:UK
|
||||
# State or Province Name (full name) [Some-State]:Derbyshire
|
||||
# Locality Name (eg, city) []:Belper
|
||||
# to create a new expired certificate:
|
||||
# faketime '2008-01-01 12:00:00' openssl req -new -x509 -keyout expired-key.pem -out expired-cert.pem -days 1 -nodes
|
||||
# Country Name (2 letter code) [AU]:DE
|
||||
# State or Province Name (full name) [Some-State]:Bavaria
|
||||
# Locality Name (eg, city) []:Munich
|
||||
# Organization Name (eg, company) [Internet Widgits Pty Ltd]:Monitoring Plugins
|
||||
# Organizational Unit Name (eg, section) []:
|
||||
# Common Name (eg, YOUR name) []:Ton Voon
|
||||
# Email Address []:tonvoon@mac.com
|
||||
# Common Name (e.g. server FQDN or YOUR name) []:Monitoring Plugins
|
||||
# Email Address []:devel@monitoring-plugins.org
|
||||
|
||||
use strict;
|
||||
use Test::More;
|
||||
|
|
@ -221,21 +223,21 @@ SKIP: {
|
|||
|
||||
$result = NPTest->testCmd( "$command -p $port_https -S -C 14" );
|
||||
is( $result->return_code, 0, "$command -p $port_https -S -C 14" );
|
||||
is( $result->output, 'OK - Certificate \'Ton Voon\' will expire on Sun Mar 3 21:41:28 2019 +0000.', "output ok" );
|
||||
is( $result->output, "OK - Certificate 'Monitoring Plugins' will expire on Fri Feb 16 15:31:44 2029 +0000.", "output ok" );
|
||||
|
||||
$result = NPTest->testCmd( "$command -p $port_https -S -C 14000" );
|
||||
is( $result->return_code, 1, "$command -p $port_https -S -C 14000" );
|
||||
like( $result->output, '/WARNING - Certificate \'Ton Voon\' expires in \d+ day\(s\) \(Sun Mar 3 21:41:28 2019 \+0000\)./', "output ok" );
|
||||
like( $result->output, '/WARNING - Certificate \'Monitoring Plugins\' expires in \d+ day\(s\) \(Fri Feb 16 15:31:44 2029 \+0000\)./', "output ok" );
|
||||
|
||||
# Expired cert tests
|
||||
$result = NPTest->testCmd( "$command -p $port_https -S -C 13960,14000" );
|
||||
is( $result->return_code, 2, "$command -p $port_https -S -C 13960,14000" );
|
||||
like( $result->output, '/CRITICAL - Certificate \'Ton Voon\' expires in \d+ day\(s\) \(Sun Mar 3 21:41:28 2019 \+0000\)./', "output ok" );
|
||||
like( $result->output, '/CRITICAL - Certificate \'Monitoring Plugins\' expires in \d+ day\(s\) \(Fri Feb 16 15:31:44 2029 \+0000\)./', "output ok" );
|
||||
|
||||
$result = NPTest->testCmd( "$command -p $port_https_expired -S -C 7" );
|
||||
is( $result->return_code, 2, "$command -p $port_https_expired -S -C 7" );
|
||||
is( $result->output,
|
||||
'CRITICAL - Certificate \'Ton Voon\' expired on Thu Mar 5 00:13:16 2009 +0000.',
|
||||
'CRITICAL - Certificate \'Monitoring Plugins\' expired on Wed Jan 2 11:00:26 2008 +0000.',
|
||||
"output ok" );
|
||||
|
||||
}
|
||||
|
|
@ -288,7 +290,6 @@ SKIP: {
|
|||
}
|
||||
|
||||
|
||||
|
||||
sub run_common_tests {
|
||||
my ($opts) = @_;
|
||||
my $command = $opts->{command};
|
||||
|
|
|
|||
Loading…
Reference in a new issue