diff options
-rw-r--r-- | NPTest.pm | 10 | ||||
-rw-r--r-- | plugins/t/check_dig.t | 20 | ||||
-rw-r--r-- | plugins/t/check_tcp.t | 16 |
3 files changed, 28 insertions, 18 deletions
@@ -645,6 +645,16 @@ sub testCmd { | |||
645 | return $object; | 645 | return $object; |
646 | } | 646 | } |
647 | 647 | ||
648 | # do we have ipv6 | ||
649 | sub has_ipv6 { | ||
650 | # assume ipv6 if a ping6 to labs.consol.de works | ||
651 | `ping6 -c 1 2a03:3680:0:2::21 2>&1`; | ||
652 | if($? == 0) { | ||
653 | return 1; | ||
654 | } | ||
655 | return; | ||
656 | } | ||
657 | |||
648 | 1; | 658 | 1; |
649 | # | 659 | # |
650 | # End of File | 660 | # End of File |
diff --git a/plugins/t/check_dig.t b/plugins/t/check_dig.t index 1ab4b42..d447f08 100644 --- a/plugins/t/check_dig.t +++ b/plugins/t/check_dig.t | |||
@@ -6,11 +6,16 @@ | |||
6 | 6 | ||
7 | use strict; | 7 | use strict; |
8 | use Test::More; | 8 | use Test::More; |
9 | use NPTest; | ||
10 | 9 | ||
11 | plan skip_all => "check_dig not compiled" unless (-x "check_dig"); | ||
12 | 10 | ||
13 | plan tests => 16; | 11 | use vars qw($tests $has_ipv6); |
12 | BEGIN { | ||
13 | plan skip_all => "check_dig not compiled" unless (-x "check_dig"); | ||
14 | use NPTest; | ||
15 | $has_ipv6 = NPTest::has_ipv6(); | ||
16 | $tests = $has_ipv6 ? 16 : 14; | ||
17 | plan tests => $tests; | ||
18 | } | ||
14 | 19 | ||
15 | my $successOutput = '/DNS OK - [\.0-9]+ seconds? response time/'; | 20 | my $successOutput = '/DNS OK - [\.0-9]+ seconds? response time/'; |
16 | 21 | ||
@@ -73,10 +78,6 @@ SKIP: { | |||
73 | cmp_ok( $res->return_code, '==', 0, "Found $hostname_valid on $dns_server"); | 78 | cmp_ok( $res->return_code, '==', 0, "Found $hostname_valid on $dns_server"); |
74 | like ( $res->output, $successOutput, "Output OK for IPv4" ); | 79 | like ( $res->output, $successOutput, "Output OK for IPv4" ); |
75 | 80 | ||
76 | $res = NPTest->testCmd("./check_dig -H $dns_server -l $hostname_valid -t 5 -6"); | ||
77 | cmp_ok( $res->return_code, '==', 0, "Found $hostname_valid on $dns_server"); | ||
78 | like ( $res->output, $successOutput, "Output OK for IPv6" ); | ||
79 | |||
80 | $res = NPTest->testCmd("./check_dig -H $dns_server -l $hostname_valid -a $hostname_valid_ip -t 5"); | 81 | $res = NPTest->testCmd("./check_dig -H $dns_server -l $hostname_valid -a $hostname_valid_ip -t 5"); |
81 | cmp_ok( $res->return_code, '==', 0, "Got expected address"); | 82 | cmp_ok( $res->return_code, '==', 0, "Got expected address"); |
82 | 83 | ||
@@ -89,4 +90,9 @@ SKIP: { | |||
89 | cmp_ok( $res->return_code, '==', 0, "Got expected fqdn"); | 90 | cmp_ok( $res->return_code, '==', 0, "Got expected fqdn"); |
90 | like ( $res->output, $successOutput, "Output OK"); | 91 | like ( $res->output, $successOutput, "Output OK"); |
91 | 92 | ||
93 | if($has_ipv6) { | ||
94 | $res = NPTest->testCmd("./check_dig -H $dns_server -l $hostname_valid -t 5 -6"); | ||
95 | cmp_ok( $res->return_code, '==', 0, "Found $hostname_valid on $dns_server"); | ||
96 | like ( $res->output, $successOutput, "Output OK for IPv6" ); | ||
97 | } | ||
92 | } | 98 | } |
diff --git a/plugins/t/check_tcp.t b/plugins/t/check_tcp.t index 0e6a964..abb16ae 100644 --- a/plugins/t/check_tcp.t +++ b/plugins/t/check_tcp.t | |||
@@ -6,19 +6,13 @@ | |||
6 | 6 | ||
7 | use strict; | 7 | use strict; |
8 | use Test; | 8 | use Test; |
9 | use NPTest; | ||
10 | 9 | ||
11 | use vars qw($tests); | 10 | use vars qw($tests $has_ipv6); |
12 | my $has_ipv6; | ||
13 | BEGIN { | 11 | BEGIN { |
14 | $tests = 11; | 12 | use NPTest; |
15 | # do we have ipv6 | 13 | $has_ipv6 = NPTest::has_ipv6(); |
16 | `ping6 -c 1 2a02:2e0:3fe:100::7 2>&1`; | 14 | $tests = $has_ipv6 ? 14 : 11; |
17 | if($? == 0) { | 15 | plan tests => $tests; |
18 | $has_ipv6 = 1; | ||
19 | $tests += 3; | ||
20 | } | ||
21 | plan tests => $tests; | ||
22 | } | 16 | } |
23 | 17 | ||
24 | 18 | ||