Imported Upstream version 2.1

This commit is contained in:
Jan Wagner 2014-10-15 14:48:52 +02:00
parent 0841b5c7c7
commit 060ec72678
47 changed files with 1718 additions and 1420 deletions

View file

@ -10,7 +10,7 @@ use NPTest;
plan skip_all => "check_dns not compiled" unless (-x "check_dns");
plan tests => 14;
plan tests => 16;
my $successOutput = '/DNS OK: [\.0-9]+ seconds? response time/';
@ -43,6 +43,12 @@ my $dns_server = getTestParameter(
"A non default (remote) DNS server",
);
my $host_nonresponsive = getTestParameter(
"NP_HOST_NONRESPONSIVE",
"The hostname of system not responsive to network requests",
"10.0.0.1",
);
my $res;
$res = NPTest->testCmd("./check_dns -H $hostname_valid -t 5");
@ -54,7 +60,7 @@ cmp_ok( $res->return_code, '==', 2, "Critical threshold passed");
$res = NPTest->testCmd("./check_dns -H $hostname_valid -t 5 -w 0 -c 5");
cmp_ok( $res->return_code, '==', 1, "Warning threshold passed");
like( $res->output, "/\|time=[\d\.]+s;0.0*;5\.0*;0\.0*/", "Output performance data OK" );
like( $res->output, '/\|time=[\d\.]+s;0.0*;5\.0*;0\.0*/', "Output performance data OK" );
$res = NPTest->testCmd("./check_dns -H $hostname_invalid -t 1");
cmp_ok( $res->return_code, '==', 2, "Invalid $hostname_invalid");
@ -66,6 +72,10 @@ like ( $res->output, $successOutput, "Output OK" );
$res = NPTest->testCmd("./check_dns -H $hostname_invalid -s $dns_server -t 1");
cmp_ok( $res->return_code, '==', 2, "Invalid $hostname_invalid on $dns_server");
$res = NPTest->testCmd("./check_dns -H $hostname_valid -a $hostname_valid_ip -s $host_nonresponsive -t 2");
cmp_ok( $res->return_code, '==', 2, "Got no answer from unresponsive server");
like ( $res->output, "/CRITICAL - /", "Output OK");
$res = NPTest->testCmd("./check_dns -H $hostname_valid -a $hostname_valid_ip -t 5");
cmp_ok( $res->return_code, '==', 0, "Got expected address");