|
|
@@ -6,11 +6,16 @@
|
|
|
|
|
|
use strict;
|
|
|
use Test::More;
|
|
|
-use NPTest;
|
|
|
|
|
|
-plan skip_all => "check_dig not compiled" unless (-x "check_dig");
|
|
|
|
|
|
-plan tests => 16;
|
|
|
+use vars qw($tests $has_ipv6);
|
|
|
+BEGIN {
|
|
|
+ plan skip_all => "check_dig not compiled" unless (-x "check_dig");
|
|
|
+ use NPTest;
|
|
|
+ $has_ipv6 = NPTest::has_ipv6();
|
|
|
+ $tests = $has_ipv6 ? 16 : 14;
|
|
|
+ plan tests => $tests;
|
|
|
+}
|
|
|
|
|
|
my $successOutput = '/DNS OK - [\.0-9]+ seconds? response time/';
|
|
|
|
|
|
@@ -73,10 +78,6 @@ SKIP: {
|
|
|
cmp_ok( $res->return_code, '==', 0, "Found $hostname_valid on $dns_server");
|
|
|
like ( $res->output, $successOutput, "Output OK for IPv4" );
|
|
|
|
|
|
- $res = NPTest->testCmd("./check_dig -H $dns_server -l $hostname_valid -t 5 -6");
|
|
|
- cmp_ok( $res->return_code, '==', 0, "Found $hostname_valid on $dns_server");
|
|
|
- like ( $res->output, $successOutput, "Output OK for IPv6" );
|
|
|
-
|
|
|
$res = NPTest->testCmd("./check_dig -H $dns_server -l $hostname_valid -a $hostname_valid_ip -t 5");
|
|
|
cmp_ok( $res->return_code, '==', 0, "Got expected address");
|
|
|
|
|
|
@@ -89,4 +90,9 @@ SKIP: {
|
|
|
cmp_ok( $res->return_code, '==', 0, "Got expected fqdn");
|
|
|
like ( $res->output, $successOutput, "Output OK");
|
|
|
|
|
|
+ if($has_ipv6) {
|
|
|
+ $res = NPTest->testCmd("./check_dig -H $dns_server -l $hostname_valid -t 5 -6");
|
|
|
+ cmp_ok( $res->return_code, '==', 0, "Found $hostname_valid on $dns_server");
|
|
|
+ like ( $res->output, $successOutput, "Output OK for IPv6" );
|
|
|
+ }
|
|
|
}
|