diff options
Diffstat (limited to 'plugins/t')
-rw-r--r-- | plugins/t/check_tcp.t | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/plugins/t/check_tcp.t b/plugins/t/check_tcp.t index c100cadd..0e6a9641 100644 --- a/plugins/t/check_tcp.t +++ b/plugins/t/check_tcp.t | |||
@@ -9,7 +9,18 @@ use Test; | |||
9 | use NPTest; | 9 | use NPTest; |
10 | 10 | ||
11 | use vars qw($tests); | 11 | use vars qw($tests); |
12 | BEGIN {$tests = 14; plan tests => $tests} | 12 | my $has_ipv6; |
13 | BEGIN { | ||
14 | $tests = 11; | ||
15 | # do we have ipv6 | ||
16 | `ping6 -c 1 2a02:2e0:3fe:100::7 2>&1`; | ||
17 | if($? == 0) { | ||
18 | $has_ipv6 = 1; | ||
19 | $tests += 3; | ||
20 | } | ||
21 | plan tests => $tests; | ||
22 | } | ||
23 | |||
13 | 24 | ||
14 | my $host_tcp_http = getTestParameter( "host_tcp_http", "NP_HOST_TCP_HTTP", "localhost", | 25 | my $host_tcp_http = getTestParameter( "host_tcp_http", "NP_HOST_TCP_HTTP", "localhost", |
15 | "A host providing the HTTP Service (a web server)" ); | 26 | "A host providing the HTTP Service (a web server)" ); |
@@ -27,7 +38,6 @@ my $failedExpect = '/^TCP WARNING\s-\sUnexpected response from host/socket on po | |||
27 | my $t; | 38 | my $t; |
28 | 39 | ||
29 | $t += checkCmd( "./check_tcp $host_tcp_http -p 80 -wt 300 -ct 600", 0, $successOutput ); | 40 | $t += checkCmd( "./check_tcp $host_tcp_http -p 80 -wt 300 -ct 600", 0, $successOutput ); |
30 | $t += checkCmd( "./check_tcp $host_tcp_http -p 80 -wt 300 -ct 600 -6 ", 0, $successOutput ); | ||
31 | $t += checkCmd( "./check_tcp $host_tcp_http -p 81 -wt 0 -ct 0 -to 1", 2 ); # use invalid port for this test | 41 | $t += checkCmd( "./check_tcp $host_tcp_http -p 81 -wt 0 -ct 0 -to 1", 2 ); # use invalid port for this test |
32 | $t += checkCmd( "./check_tcp $host_nonresponsive -p 80 -wt 0 -ct 0 -to 1", 2 ); | 42 | $t += checkCmd( "./check_tcp $host_nonresponsive -p 80 -wt 0 -ct 0 -to 1", 2 ); |
33 | $t += checkCmd( "./check_tcp $hostname_invalid -p 80 -wt 0 -ct 0 -to 1", 2 ); | 43 | $t += checkCmd( "./check_tcp $hostname_invalid -p 80 -wt 0 -ct 0 -to 1", 2 ); |
@@ -35,11 +45,16 @@ $t += checkCmd( "./check_tcp -S -D 1 -H www.verisign.com -p 443", 0 | |||
35 | $t += checkCmd( "./check_tcp -S -D 9000,1 -H www.verisign.com -p 443", 1 ); | 45 | $t += checkCmd( "./check_tcp -S -D 9000,1 -H www.verisign.com -p 443", 1 ); |
36 | $t += checkCmd( "./check_tcp -S -D 9000 -H www.verisign.com -p 443", 1 ); | 46 | $t += checkCmd( "./check_tcp -S -D 9000 -H www.verisign.com -p 443", 1 ); |
37 | $t += checkCmd( "./check_tcp -S -D 9000,8999 -H www.verisign.com -p 443", 2 ); | 47 | $t += checkCmd( "./check_tcp -S -D 9000,8999 -H www.verisign.com -p 443", 2 ); |
38 | $t += checkCmd( "./check_tcp -6 -p 80 www.heise.de", 0 ); | ||
39 | 48 | ||
40 | # Need the \r\n to make it more standards compliant with web servers. Need the various quotes | 49 | # Need the \r\n to make it more standards compliant with web servers. Need the various quotes |
41 | # so that perl doesn't interpret the \r\n and is passed onto command line correctly | 50 | # so that perl doesn't interpret the \r\n and is passed onto command line correctly |
42 | $t += checkCmd( "./check_tcp $host_tcp_http -p 80 -E -s ".'"GET / HTTP/1.1\r\n\r\n"'." -e 'ThisShouldntMatch' -j", 1, $failedExpect ); | 51 | $t += checkCmd( "./check_tcp $host_tcp_http -p 80 -E -s ".'"GET / HTTP/1.1\r\n\r\n"'." -e 'ThisShouldntMatch' -j", 1, $failedExpect ); |
43 | 52 | ||
53 | # IPv6 checks | ||
54 | if($has_ipv6) { | ||
55 | $t += checkCmd( "./check_tcp $host_tcp_http -p 80 -wt 300 -ct 600 -6 ", 0, $successOutput ); | ||
56 | $t += checkCmd( "./check_tcp -6 -p 80 www.heise.de", 0 ); | ||
57 | } | ||
58 | |||
44 | exit(0) if defined($Test::Harness::VERSION); | 59 | exit(0) if defined($Test::Harness::VERSION); |
45 | exit($tests - $t); | 60 | exit($tests - $t); |