summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NPTest.pm10
-rw-r--r--plugins/t/check_dig.t20
-rw-r--r--plugins/t/check_tcp.t16
3 files changed, 28 insertions, 18 deletions
diff --git a/NPTest.pm b/NPTest.pm
index c719776..f14657c 100644
--- a/NPTest.pm
+++ b/NPTest.pm
@@ -645,6 +645,16 @@ sub testCmd {
645 return $object; 645 return $object;
646} 646}
647 647
648# do we have ipv6
649sub 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
6481; 6581;
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
7use strict; 7use strict;
8use Test::More; 8use Test::More;
9use NPTest;
10 9
11plan skip_all => "check_dig not compiled" unless (-x "check_dig");
12 10
13plan tests => 16; 11use vars qw($tests $has_ipv6);
12BEGIN {
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
15my $successOutput = '/DNS OK - [\.0-9]+ seconds? response time/'; 20my $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
7use strict; 7use strict;
8use Test; 8use Test;
9use NPTest;
10 9
11use vars qw($tests); 10use vars qw($tests $has_ipv6);
12my $has_ipv6;
13BEGIN { 11BEGIN {
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