diff options
Diffstat (limited to 'plugins/tests/check_http.t')
| -rwxr-xr-x | plugins/tests/check_http.t | 29 | 
1 files changed, 12 insertions, 17 deletions
| diff --git a/plugins/tests/check_http.t b/plugins/tests/check_http.t index c3085e13..225b449f 100755 --- a/plugins/tests/check_http.t +++ b/plugins/tests/check_http.t | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | # Country Name (2 letter code) [AU]:UK | 7 | # Country Name (2 letter code) [AU]:UK | 
| 8 | # State or Province Name (full name) [Some-State]:Derbyshire | 8 | # State or Province Name (full name) [Some-State]:Derbyshire | 
| 9 | # Locality Name (eg, city) []:Belper | 9 | # Locality Name (eg, city) []:Belper | 
| 10 | # Organization Name (eg, company) [Internet Widgits Pty Ltd]:Nagios Plugins | 10 | # Organization Name (eg, company) [Internet Widgits Pty Ltd]:Monitoring Plugins | 
| 11 | # Organizational Unit Name (eg, section) []: | 11 | # Organizational Unit Name (eg, section) []: | 
| 12 | # Common Name (eg, YOUR name) []:Ton Voon | 12 | # Common Name (eg, YOUR name) []:Ton Voon | 
| 13 | # Email Address []:tonvoon@mac.com | 13 | # Email Address []:tonvoon@mac.com | 
| @@ -20,8 +20,9 @@ use FindBin qw($Bin); | |||
| 20 | my $common_tests = 70; | 20 | my $common_tests = 70; | 
| 21 | my $ssl_only_tests = 8; | 21 | my $ssl_only_tests = 8; | 
| 22 | # Check that all dependent modules are available | 22 | # Check that all dependent modules are available | 
| 23 | eval "use HTTP::Daemon 6.01;"; | ||
| 24 | plan skip_all => 'HTTP::Daemon >= 6.01 required' if $@; | ||
| 23 | eval { | 25 | eval { | 
| 24 | require HTTP::Daemon; | ||
| 25 | require HTTP::Status; | 26 | require HTTP::Status; | 
| 26 | require HTTP::Response; | 27 | require HTTP::Response; | 
| 27 | }; | 28 | }; | 
| @@ -392,27 +393,21 @@ sub run_common_tests { | |||
| 392 | skip "This doesn't seems to work all the time", 1 unless ($ENV{HTTP_EXTERNAL}); | 393 | skip "This doesn't seems to work all the time", 1 unless ($ENV{HTTP_EXTERNAL}); | 
| 393 | $cmd = "$command -f follow -u /redir_external -t 5"; | 394 | $cmd = "$command -f follow -u /redir_external -t 5"; | 
| 394 | eval { | 395 | eval { | 
| 395 | local $SIG{ALRM} = sub { die "alarm\n" }; | 396 | $result = NPTest->testCmd( $cmd, 2 ); | 
| 396 | alarm(2); | 397 | }; | 
| 397 | $result = NPTest->testCmd( $cmd ); | 398 | like( $@, "/timeout in command: $cmd/", $cmd ); | 
| 398 | alarm(0); }; | ||
| 399 | is( $@, "alarm\n", $cmd ); | ||
| 400 | } | 399 | } | 
| 401 | 400 | ||
| 402 | $cmd = "$command -u /timeout -t 5"; | 401 | $cmd = "$command -u /timeout -t 5"; | 
| 403 | eval { | 402 | eval { | 
| 404 | local $SIG{ALRM} = sub { die "alarm\n" }; | 403 | $result = NPTest->testCmd( $cmd, 2 ); | 
| 405 | alarm(2); | 404 | }; | 
| 406 | $result = NPTest->testCmd( $cmd ); | 405 | like( $@, "/timeout in command: $cmd/", $cmd ); | 
| 407 | alarm(0); }; | ||
| 408 | is( $@, "alarm\n", $cmd ); | ||
| 409 | 406 | ||
| 410 | $cmd = "$command -f follow -u /redir_timeout -t 2"; | 407 | $cmd = "$command -f follow -u /redir_timeout -t 2"; | 
| 411 | eval { | 408 | eval { | 
| 412 | local $SIG{ALRM} = sub { die "alarm\n" }; | 409 | $result = NPTest->testCmd( $cmd, 5 ); | 
| 413 | alarm(5); | 410 | }; | 
| 414 | $result = NPTest->testCmd( $cmd ); | 411 | is( $@, "", $cmd ); | 
| 415 | alarm(0); }; | ||
| 416 | isnt( $@, "alarm\n", $cmd ); | ||
| 417 | 412 | ||
| 418 | } | 413 | } | 
