diff options
author | Jonny007-MKD <nospam@jonny007-mkd.de> | 2020-02-23 15:02:43 +0100 |
---|---|---|
committer | Sven Nierlein <sven@nierlein.org> | 2021-09-02 09:56:39 +0200 |
commit | 70f55ca9db87f639856e0548a57081c886e09d14 (patch) | |
tree | 30447f835c82feab6f281c07c1db4705aeb51ab9 /plugins/t | |
parent | 9fa291d9918722ce3e3a43ad61da572e271f4f83 (diff) | |
download | monitoring-plugins-70f55ca9db87f639856e0548a57081c886e09d14.tar.gz |
check_dns: add --expect-nxdomain
Diffstat (limited to 'plugins/t')
-rw-r--r-- | plugins/t/check_dns.t | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/plugins/t/check_dns.t b/plugins/t/check_dns.t index cdfbe60d..1e7d5340 100644 --- a/plugins/t/check_dns.t +++ b/plugins/t/check_dns.t | |||
@@ -10,7 +10,7 @@ use NPTest; | |||
10 | 10 | ||
11 | plan skip_all => "check_dns not compiled" unless (-x "check_dns"); | 11 | plan skip_all => "check_dns not compiled" unless (-x "check_dns"); |
12 | 12 | ||
13 | plan tests => 19; | 13 | plan tests => 23; |
14 | 14 | ||
15 | my $successOutput = '/DNS OK: [\.0-9]+ seconds? response time/'; | 15 | my $successOutput = '/DNS OK: [\.0-9]+ seconds? response time/'; |
16 | 16 | ||
@@ -58,7 +58,7 @@ my $dns_server = getTestParameter( | |||
58 | my $host_nonresponsive = getTestParameter( | 58 | my $host_nonresponsive = getTestParameter( |
59 | "NP_HOST_NONRESPONSIVE", | 59 | "NP_HOST_NONRESPONSIVE", |
60 | "The hostname of system not responsive to network requests", | 60 | "The hostname of system not responsive to network requests", |
61 | "10.0.0.1", | 61 | "192.0.2.0", |
62 | ); | 62 | ); |
63 | 63 | ||
64 | my $res; | 64 | my $res; |
@@ -105,3 +105,11 @@ cmp_ok( $res->return_code, '==', 0, "Got expected address"); | |||
105 | $res = NPTest->testCmd("./check_dns -H $hostname_valid -a $hostname_invalid_cidr -t 5"); | 105 | $res = NPTest->testCmd("./check_dns -H $hostname_valid -a $hostname_invalid_cidr -t 5"); |
106 | cmp_ok( $res->return_code, '==', 2, "Got wrong address"); | 106 | cmp_ok( $res->return_code, '==', 2, "Got wrong address"); |
107 | like ( $res->output, "/^DNS CRITICAL.*expected '$hostname_invalid_cidr' but got '$hostname_valid_ip'".'$/', "Output OK"); | 107 | like ( $res->output, "/^DNS CRITICAL.*expected '$hostname_invalid_cidr' but got '$hostname_valid_ip'".'$/', "Output OK"); |
108 | |||
109 | $res = NPTest->testCmd("./check_dns -H $hostname_valid -n"); | ||
110 | cmp_ok( $res->return_code, '==', 2, "Found $hostname_valid"); | ||
111 | like ( $res->output, "/^DNS CRITICAL.*Domain '$hostname_valid' was found by the server:/", "Output OK"); | ||
112 | |||
113 | $res = NPTest->testCmd("./check_dns -H $hostname_invalid -n"); | ||
114 | cmp_ok( $res->return_code, '==', 0, "Did not find $hostname_invalid"); | ||
115 | like ( $res->output, $successOutput, "Output OK" ); | ||