summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5537f7b)
raw | patch | inline | side by side (parent: 5537f7b)
author | Ton Voon <tonvoon@users.sourceforge.net> | |
Thu, 3 Nov 2005 15:04:16 +0000 (15:04 +0000) | ||
committer | Ton Voon <tonvoon@users.sourceforge.net> | |
Thu, 3 Nov 2005 15:04:16 +0000 (15:04 +0000) |
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1270 f882894a-f735-0410-b71e-b25c423dba1c
NPTest.pm | patch | blob | history | |
plugins/t/check_http.t | patch | blob | history | |
plugins/t/check_time.t | patch | blob | history |
diff --git a/NPTest.pm b/NPTest.pm
index 201bc6ae7102bd942f438bfecc58eba8d4ddd4f5..8f20678b5f8dab2f860d7efeb362e1da2a176d0a 100644 (file)
--- a/NPTest.pm
+++ b/NPTest.pm
command and the output (if any) it generated. Simplifying these tests
into a single function call, makes the test harness easier to read and
maintain and allows additional functionality (such as debugging) to be
-provided withoutadditional effort on the part of the test harness
+provided without additional effort on the part of the test harness
developer.
It is possible to enable debugging via the environment variable
if ( %exceptions && exists( $exceptions{$exitStatus} ) )
{
$testStatus += skip( $exceptions{$exitStatus}, $exitStatus, $desiredExitStatus );
+ $testOutput = "skip";
}
else
{
if ( defined( $envvar ) && exists( $ENV{$envvar} ) && $ENV{$envvar} )
{
- return $ENV{$envvar}
+ return $ENV{$envvar};
}
my $cachedValue = SearchCache( $param, $testharness );
diff --git a/plugins/t/check_http.t b/plugins/t/check_http.t
index 56d939b3db103ec8c40faba3e116a9e941cb8744..d97991419960097ef1efb0807ffe018c0dc7ddc2 100644 (file)
--- a/plugins/t/check_http.t
+++ b/plugins/t/check_http.t
my $hostname_invalid = getTestParameter( "hostname_invalid", "NP_HOSTNAME_INVALID", "nosuchhost",
"An invalid (not known to DNS) hostname" );
-my $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/';
+my $successOutput = '/OK.*HTTP.*second/';
my %exceptions = ( 2 => "No Web Server present?" );
diff --git a/plugins/t/check_time.t b/plugins/t/check_time.t
index 05878dc2a536c0dcbee40e86f59262ac526b65c7..f7fcf959e25001333a449d1ee4da9e00a5a5569f 100644 (file)
--- a/plugins/t/check_time.t
+++ b/plugins/t/check_time.t
my $successOutput = '/^TIME OK - [0-9]+ second time difference/';
+my %exceptions = ( 3 => "No time server present?");
+
my $t;
# standard mode
-$t += checkCmd( "./check_time -H $host_udp_time -w 999999,59 -c 999999,59 -t 60", 0, $successOutput );
-$t += checkCmd( "./check_time -H $host_udp_time -w 999999 -W 59 -c 999999 -C 59 -t 60", 0, $successOutput );
+$t += checkCmd( "./check_time -H $host_udp_time -w 999999,59 -c 999999,59 -t 60", 0, $successOutput, %exceptions );
+$t += checkCmd( "./check_time -H $host_udp_time -w 999999 -W 59 -c 999999 -C 59 -t 60", 0, $successOutput, %exceptions );
# reverse compatibility mode
-$t += checkCmd( "./check_time $host_udp_time -wt 59 -ct 59 -cd 999999 -wd 999999 -to 60", 0, $successOutput );
+$t += checkCmd( "./check_time $host_udp_time -wt 59 -ct 59 -cd 999999 -wd 999999 -to 60", 0, $successOutput, %exceptions );
# failure mode
$t += checkCmd( "./check_time -H $host_nonresponsive -t 1", 2 );