diff options
Diffstat (limited to 'plugins/t/check_http.t')
-rw-r--r-- | plugins/t/check_http.t | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/plugins/t/check_http.t b/plugins/t/check_http.t index 9b90fd06..24e4fd6d 100644 --- a/plugins/t/check_http.t +++ b/plugins/t/check_http.t | |||
@@ -9,6 +9,8 @@ use strict; | |||
9 | use Test::More; | 9 | use Test::More; |
10 | use NPTest; | 10 | use NPTest; |
11 | 11 | ||
12 | plan tests => 12; | ||
13 | |||
12 | my $successOutput = '/OK.*HTTP.*second/'; | 14 | my $successOutput = '/OK.*HTTP.*second/'; |
13 | 15 | ||
14 | my $res; | 16 | my $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 | ||
28 | plan 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 | ); |
46 | cmp_ok( $res->return_code, '==', 2, "Webserver $hostname_invalid not valid" ); | 45 | cmp_ok( $res->return_code, '==', 2, "Webserver $hostname_invalid not valid" ); |
47 | like( $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 | ||
48 | like( $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 | ); |
52 | cmp_ok( $res->return_code, '==', 0, "Can read https for www.verisign.com" ); | 53 | cmp_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" ); | ||
56 | cmp_ok( $res->return_code, '==', 0, "Checking certificate for www.verisign.com"); | ||
57 | like ( $res->output, '/Certificate will expire on/', "Output OK" ); | ||
58 | my $saved_cert_output = $res->output; | ||
59 | |||
60 | $res = NPTest->testCmd( "./check_http -C 1 www.verisign.com" ); | ||
61 | cmp_ok( $res->output, 'eq', $saved_cert_output, "--ssl option automatically added"); | ||
62 | |||
63 | $res = NPTest->testCmd( "./check_http www.verisign.com -C 1" ); | ||
64 | cmp_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 | ); |
57 | cmp_ok( $res->return_code, "==", 0, "Can read https for www.e-paycobalt.com (uses AES certificate)" ); | 69 | cmp_ok( $res->return_code, "==", 0, "Can read https for www.e-paycobalt.com (uses AES certificate)" ); |
70 | |||
71 | |||