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.t32
1 files changed, 17 insertions, 15 deletions
diff --git a/plugins/t/check_http.t b/plugins/t/check_http.t
index 0a25c77..9948c53 100644
--- a/plugins/t/check_http.t
+++ b/plugins/t/check_http.t
@@ -8,22 +8,22 @@ use strict;
8use Test::More; 8use Test::More;
9use NPTest; 9use NPTest;
10 10
11plan tests => 28; 11plan tests => 30;
12 12
13my $successOutput = '/OK.*HTTP.*second/'; 13my $successOutput = '/OK.*HTTP.*second/';
14 14
15my $res; 15my $res;
16 16
17my $host_tcp_http = getTestParameter( "NP_HOST_TCP_HTTP", 17my $host_tcp_http = getTestParameter( "NP_HOST_TCP_HTTP",
18 "A host providing the HTTP Service (a web server)", 18 "A host providing the HTTP Service (a web server)",
19 "localhost" ); 19 "localhost" );
20 20
21my $host_nonresponsive = getTestParameter( "NP_HOST_NONRESPONSIVE", 21my $host_nonresponsive = getTestParameter( "NP_HOST_NONRESPONSIVE",
22 "The hostname of system not responsive to network requests", 22 "The hostname of system not responsive to network requests",
23 "10.0.0.1" ); 23 "10.0.0.1" );
24 24
25my $hostname_invalid = getTestParameter( "NP_HOSTNAME_INVALID", 25my $hostname_invalid = getTestParameter( "NP_HOSTNAME_INVALID",
26 "An invalid (not known to DNS) hostname", 26 "An invalid (not known to DNS) hostname",
27 "nosuchhost"); 27 "nosuchhost");
28 28
29my $internet_access = getTestParameter( "NP_INTERNET_ACCESS", 29my $internet_access = getTestParameter( "NP_INTERNET_ACCESS",
@@ -32,8 +32,8 @@ my $internet_access = getTestParameter( "NP_INTERNET_ACCESS",
32 32
33my $host_tcp_http2; 33my $host_tcp_http2;
34if ($internet_access eq "no") { 34if ($internet_access eq "no") {
35 $host_tcp_http2 = getTestParameter( "NP_HOST_TCP_HTTP2", 35 $host_tcp_http2 = getTestParameter( "NP_HOST_TCP_HTTP2",
36 "A host providing an index page containing the string 'nagios'", 36 "A host providing an index page containing the string 'nagios'",
37 "www.nagios.com" ); 37 "www.nagios.com" );
38} 38}
39 39
@@ -45,14 +45,9 @@ cmp_ok( $res->return_code, '==', 0, "Webserver $host_tcp_http responded" );
45like( $res->output, $successOutput, "Output OK" ); 45like( $res->output, $successOutput, "Output OK" );
46 46
47$res = NPTest->testCmd( 47$res = NPTest->testCmd(
48 "./check_http $host_tcp_http -wt 300 -ct 600 -v -v -v -k 'bob:there;fred:here'" 48 "./check_http $host_tcp_http -wt 300 -ct 600 -v -v -v -k 'bob:there' -k 'carl:frown'"
49 ); 49 );
50like( $res->output, '/bob:there\r\nfred:here\r\n/', "Got headers, delimited with ';'" ); 50like( $res->output, '/bob:there\r\ncarl:frown\r\n/', "Got headers with multiple -k options" );
51
52$res = NPTest->testCmd(
53 "./check_http $host_tcp_http -wt 300 -ct 600 -v -v -v -k 'bob:there;fred:here' -k 'carl:frown'"
54 );
55like( $res->output, '/bob:there\r\nfred:here\r\ncarl:frown\r\n/', "Got headers with multiple -k options" );
56 51
57$res = NPTest->testCmd( 52$res = NPTest->testCmd(
58 "./check_http $host_nonresponsive -wt 1 -ct 2" 53 "./check_http $host_nonresponsive -wt 1 -ct 2"
@@ -123,6 +118,10 @@ SKIP: {
123 $res = NPTest->testCmd( "./check_http www.verisign.com -C 1" ); 118 $res = NPTest->testCmd( "./check_http www.verisign.com -C 1" );
124 cmp_ok( $res->output, 'eq', $saved_cert_output, "Old syntax for cert checking still works"); 119 cmp_ok( $res->output, 'eq', $saved_cert_output, "Old syntax for cert checking still works");
125 120
121 $res = NPTest->testCmd( "./check_http --ssl www.verisign.com -E" );
122 like ( $res->output, '/time_connect=[\d\.]+/', 'Extended Performance Data Output OK' );
123 like ( $res->output, '/time_ssl=[\d\.]+/', 'Extended Performance Data SSL Output OK' );
124
126 $res = NPTest->testCmd( 125 $res = NPTest->testCmd(
127 "./check_http --ssl www.e-paycobalt.com" 126 "./check_http --ssl www.e-paycobalt.com"
128 ); 127 );
@@ -131,4 +130,7 @@ SKIP: {
131 130
132 $res = NPTest->testCmd( "./check_http -H www.mozilla.com -u /firefox -f follow" ); 131 $res = NPTest->testCmd( "./check_http -H www.mozilla.com -u /firefox -f follow" );
133 is( $res->return_code, 0, "Redirection based on location is okay"); 132 is( $res->return_code, 0, "Redirection based on location is okay");
133
134 $res = NPTest->testCmd( "./check_http -H www.mozilla.com --extended-perfdata" );
135 like ( $res->output, '/time_connect=[\d\.]+/', 'Extended Performance Data Output OK' );
134} 136}