summaryrefslogtreecommitdiffstats
path: root/plugins/t/check_dns.t
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/t/check_dns.t')
-rw-r--r--plugins/t/check_dns.t12
1 files changed, 11 insertions, 1 deletions
diff --git a/plugins/t/check_dns.t b/plugins/t/check_dns.t
index b885880..035e768 100644
--- a/plugins/t/check_dns.t
+++ b/plugins/t/check_dns.t
@@ -10,7 +10,7 @@ use NPTest;
10 10
11plan skip_all => "check_dns not compiled" unless (-x "check_dns"); 11plan skip_all => "check_dns not compiled" unless (-x "check_dns");
12 12
13plan tests => 14; 13plan tests => 16;
14 14
15my $successOutput = '/DNS OK: [\.0-9]+ seconds? response time/'; 15my $successOutput = '/DNS OK: [\.0-9]+ seconds? response time/';
16 16
@@ -43,6 +43,12 @@ my $dns_server = getTestParameter(
43 "A non default (remote) DNS server", 43 "A non default (remote) DNS server",
44 ); 44 );
45 45
46my $host_nonresponsive = getTestParameter(
47 "NP_HOST_NONRESPONSIVE",
48 "The hostname of system not responsive to network requests",
49 "10.0.0.1",
50 );
51
46my $res; 52my $res;
47 53
48$res = NPTest->testCmd("./check_dns -H $hostname_valid -t 5"); 54$res = NPTest->testCmd("./check_dns -H $hostname_valid -t 5");
@@ -66,6 +72,10 @@ like ( $res->output, $successOutput, "Output OK" );
66$res = NPTest->testCmd("./check_dns -H $hostname_invalid -s $dns_server -t 1"); 72$res = NPTest->testCmd("./check_dns -H $hostname_invalid -s $dns_server -t 1");
67cmp_ok( $res->return_code, '==', 2, "Invalid $hostname_invalid on $dns_server"); 73cmp_ok( $res->return_code, '==', 2, "Invalid $hostname_invalid on $dns_server");
68 74
75$res = NPTest->testCmd("./check_dns -H $hostname_valid -a $hostname_valid_ip -s $host_nonresponsive -t 2");
76cmp_ok( $res->return_code, '==', 2, "Got no answer from unresponsive server");
77like ( $res->output, "/CRITICAL - /", "Output OK");
78
69$res = NPTest->testCmd("./check_dns -H $hostname_valid -a $hostname_valid_ip -t 5"); 79$res = NPTest->testCmd("./check_dns -H $hostname_valid -a $hostname_valid_ip -t 5");
70cmp_ok( $res->return_code, '==', 0, "Got expected address"); 80cmp_ok( $res->return_code, '==', 0, "Got expected address");
71 81