diff options
Diffstat (limited to 'plugins/t/check_dig.t')
-rw-r--r-- | plugins/t/check_dig.t | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/plugins/t/check_dig.t b/plugins/t/check_dig.t index 1ab4b426..d447f084 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 | } |