summaryrefslogtreecommitdiffstats
path: root/plugins/t/check_http.t
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/t/check_http.t')
-rw-r--r--plugins/t/check_http.t22
1 files changed, 18 insertions, 4 deletions
diff --git a/plugins/t/check_http.t b/plugins/t/check_http.t
index 9b90fd0..24e4fd6 100644
--- a/plugins/t/check_http.t
+++ b/plugins/t/check_http.t
@@ -9,6 +9,8 @@ use strict;
9use Test::More; 9use Test::More;
10use NPTest; 10use NPTest;
11 11
12plan tests => 12;
13
12my $successOutput = '/OK.*HTTP.*second/'; 14my $successOutput = '/OK.*HTTP.*second/';
13 15
14my $res; 16my $res;
@@ -25,9 +27,6 @@ my $hostname_invalid = getTestParameter( "NP_HOSTNAME_INVALID",
25 "An invalid (not known to DNS) hostname", 27 "An invalid (not known to DNS) hostname",
26 "nosuchhost"); 28 "nosuchhost");
27 29
28plan tests => 8;
29
30
31$res = NPTest->testCmd( 30$res = NPTest->testCmd(
32 "./check_http $host_tcp_http -wt 300 -ct 600" 31 "./check_http $host_tcp_http -wt 300 -ct 600"
33 ); 32 );
@@ -44,14 +43,29 @@ $res = NPTest->testCmd(
44 "./check_http $hostname_invalid -wt 1 -ct 2" 43 "./check_http $hostname_invalid -wt 1 -ct 2"
45 ); 44 );
46cmp_ok( $res->return_code, '==', 2, "Webserver $hostname_invalid not valid" ); 45cmp_ok( $res->return_code, '==', 2, "Webserver $hostname_invalid not valid" );
47like( $res->output, "/Name or service not known.*/", "Output OK"); 46# The first part of the message comes from the OS catalogue, so cannot check this.
47# On Debian, it is Name or service not known, on Darwin, it is No address associated with nodename
48like( $res->output, "/Unable to open TCP socket/", "Output OK");
48 49
49$res = NPTest->testCmd( 50$res = NPTest->testCmd(
50 "./check_http --ssl www.verisign.com" 51 "./check_http --ssl www.verisign.com"
51 ); 52 );
52cmp_ok( $res->return_code, '==', 0, "Can read https for www.verisign.com" ); 53cmp_ok( $res->return_code, '==', 0, "Can read https for www.verisign.com" );
53 54
55$res = NPTest->testCmd( "./check_http -C 1 --ssl www.verisign.com" );
56cmp_ok( $res->return_code, '==', 0, "Checking certificate for www.verisign.com");
57like ( $res->output, '/Certificate will expire on/', "Output OK" );
58my $saved_cert_output = $res->output;
59
60$res = NPTest->testCmd( "./check_http -C 1 www.verisign.com" );
61cmp_ok( $res->output, 'eq', $saved_cert_output, "--ssl option automatically added");
62
63$res = NPTest->testCmd( "./check_http www.verisign.com -C 1" );
64cmp_ok( $res->output, 'eq', $saved_cert_output, "Old syntax for cert checking still works");
65
54$res = NPTest->testCmd( 66$res = NPTest->testCmd(
55 "./check_http --ssl www.e-paycobalt.com" 67 "./check_http --ssl www.e-paycobalt.com"
56 ); 68 );
57cmp_ok( $res->return_code, "==", 0, "Can read https for www.e-paycobalt.com (uses AES certificate)" ); 69cmp_ok( $res->return_code, "==", 0, "Can read https for www.e-paycobalt.com (uses AES certificate)" );
70
71