summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NPTest.pm5
-rw-r--r--plugins/t/check_http.t2
-rw-r--r--plugins/t/check_time.t8
3 files changed, 9 insertions, 6 deletions
diff --git a/NPTest.pm b/NPTest.pm
index 201bc6ae..8f20678b 100644
--- a/NPTest.pm
+++ b/NPTest.pm
@@ -88,7 +88,7 @@ typical tests we wish to perform are against the exit status of the
88command and the output (if any) it generated. Simplifying these tests 88command and the output (if any) it generated. Simplifying these tests
89into a single function call, makes the test harness easier to read and 89into a single function call, makes the test harness easier to read and
90maintain and allows additional functionality (such as debugging) to be 90maintain and allows additional functionality (such as debugging) to be
91provided withoutadditional effort on the part of the test harness 91provided without additional effort on the part of the test harness
92developer. 92developer.
93 93
94It is possible to enable debugging via the environment variable 94It is possible to enable debugging via the environment variable
@@ -264,6 +264,7 @@ sub checkCmd
264 if ( %exceptions && exists( $exceptions{$exitStatus} ) ) 264 if ( %exceptions && exists( $exceptions{$exitStatus} ) )
265 { 265 {
266 $testStatus += skip( $exceptions{$exitStatus}, $exitStatus, $desiredExitStatus ); 266 $testStatus += skip( $exceptions{$exitStatus}, $exitStatus, $desiredExitStatus );
267 $testOutput = "skip";
267 } 268 }
268 else 269 else
269 { 270 {
@@ -312,7 +313,7 @@ sub getTestParameter
312 313
313 if ( defined( $envvar ) && exists( $ENV{$envvar} ) && $ENV{$envvar} ) 314 if ( defined( $envvar ) && exists( $ENV{$envvar} ) && $ENV{$envvar} )
314 { 315 {
315 return $ENV{$envvar} 316 return $ENV{$envvar};
316 } 317 }
317 318
318 my $cachedValue = SearchCache( $param, $testharness ); 319 my $cachedValue = SearchCache( $param, $testharness );
diff --git a/plugins/t/check_http.t b/plugins/t/check_http.t
index 56d939b3..d9799141 100644
--- a/plugins/t/check_http.t
+++ b/plugins/t/check_http.t
@@ -21,7 +21,7 @@ my $host_nonresponsive = getTestParameter( "host_nonresponsive", "NP_HOST_NONRES
21my $hostname_invalid = getTestParameter( "hostname_invalid", "NP_HOSTNAME_INVALID", "nosuchhost", 21my $hostname_invalid = getTestParameter( "hostname_invalid", "NP_HOSTNAME_INVALID", "nosuchhost",
22 "An invalid (not known to DNS) hostname" ); 22 "An invalid (not known to DNS) hostname" );
23 23
24my $successOutput = '/(HTTP\s[o|O][k|K]\s)?\s?HTTP\/1.[01]\s[0-9]{3}\s(OK|Found)\s-\s+[0-9]+\sbytes\sin\s+([0-9]+|[0-9]+\.[0-9]+)\sseconds/'; 24my $successOutput = '/OK.*HTTP.*second/';
25 25
26my %exceptions = ( 2 => "No Web Server present?" ); 26my %exceptions = ( 2 => "No Web Server present?" );
27 27
diff --git a/plugins/t/check_time.t b/plugins/t/check_time.t
index 05878dc2..f7fcf959 100644
--- a/plugins/t/check_time.t
+++ b/plugins/t/check_time.t
@@ -23,14 +23,16 @@ my $hostname_invalid = getTestParameter( "hostname_invalid", "NP_HOSTNAME_IN
23 23
24my $successOutput = '/^TIME OK - [0-9]+ second time difference/'; 24my $successOutput = '/^TIME OK - [0-9]+ second time difference/';
25 25
26my %exceptions = ( 3 => "No time server present?");
27
26my $t; 28my $t;
27 29
28# standard mode 30# standard mode
29$t += checkCmd( "./check_time -H $host_udp_time -w 999999,59 -c 999999,59 -t 60", 0, $successOutput ); 31$t += checkCmd( "./check_time -H $host_udp_time -w 999999,59 -c 999999,59 -t 60", 0, $successOutput, %exceptions );
30$t += checkCmd( "./check_time -H $host_udp_time -w 999999 -W 59 -c 999999 -C 59 -t 60", 0, $successOutput ); 32$t += checkCmd( "./check_time -H $host_udp_time -w 999999 -W 59 -c 999999 -C 59 -t 60", 0, $successOutput, %exceptions );
31 33
32# reverse compatibility mode 34# reverse compatibility mode
33$t += checkCmd( "./check_time $host_udp_time -wt 59 -ct 59 -cd 999999 -wd 999999 -to 60", 0, $successOutput ); 35$t += checkCmd( "./check_time $host_udp_time -wt 59 -ct 59 -cd 999999 -wd 999999 -to 60", 0, $successOutput, %exceptions );
34 36
35# failure mode 37# failure mode
36$t += checkCmd( "./check_time -H $host_nonresponsive -t 1", 2 ); 38$t += checkCmd( "./check_time -H $host_nonresponsive -t 1", 2 );