summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: aac4f45)
raw | patch | inline | side by side (parent: aac4f45)
author | Matthew Kent <mattkent@users.sourceforge.net> | |
Thu, 25 Nov 2004 05:06:25 +0000 (05:06 +0000) | ||
committer | Matthew Kent <mattkent@users.sourceforge.net> | |
Thu, 25 Nov 2004 05:06:25 +0000 (05:06 +0000) |
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@942 f882894a-f735-0410-b71e-b25c423dba1c
diff --git a/plugins/t/check_dns.t b/plugins/t/check_dns.t
index a85e2e764c4412563b4de61d306a819e0a386a9c..bee1d34b0d7988f13a07a442c34ce7ddb4dfa544 100644 (file)
--- a/plugins/t/check_dns.t
+++ b/plugins/t/check_dns.t
my $str;
my $t;
-$cmd = "./check_dns 127.0.0.1 -to 5";
-$str = `$cmd`;
+$str = `./check_dns $Cache::dnshost -to 5`;
$t += ok $?>>8,0;
print "Test was: $cmd\n" if ($?);
-$t += ok $str, '/DNS ok - +[\.0-9]+ seconds response time, Address\(es\) is\/are /';
+$t += ok $str, '/DNS OK: +[\.0-9]+ seconds response time, /';
$cmd = "./check_dns $Cache::nullhost -to 1";
$str = `$cmd`;
diff --git a/plugins/t/check_http.t b/plugins/t/check_http.t
index 0c71794feb4f85f89f4ac4477add91d2e9f98ece..5be549ad3b8f2123c7ff9f36a9f7c1f12cda6574 100644 (file)
--- a/plugins/t/check_http.t
+++ b/plugins/t/check_http.t
my $str;
my $t;
-$str = `./check_http $Cache::hostname -wt 300 -ct 600`;
+$str = `./check_http $Cache::httphost -wt 300 -ct 600`;
$t += ok $?>>8,0;
-$t += ok $str, '/(HTTP\s[o|O][k|K]\s)?\s?HTTP\/1.[01]\s[0-9]{3}\s(OK|Found)\s-\s+([0-9]+|[0-9]+\.[0-9]+)\ssecond response time/';
+$t += ok $str, '/(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/';
$str = `./check_http $Cache::nullhost -wt 1 -ct 2`;
$t += ok $?>>8,2;
diff --git a/plugins/t/check_load.t b/plugins/t/check_load.t
index fce168fc81fdb708152118e83b610e1fd85a0c3d..414e09d6db7954210c2637f36f23a994f23176b1 100644 (file)
--- a/plugins/t/check_load.t
+++ b/plugins/t/check_load.t
$str = `$cmd`;
$t += ok $?>>8,0;
print "Test was: $cmd\n" if ($?);
-$t += ok $str, '/^OK - load average: [0-9]\.?[0-9]+, [0-9]\.?[0-9]+, [0-9]\.?[0-9]+$/';
+$t += ok $str, '/^OK - load average: [0-9]\.?[0-9]+, [0-9]\.?[0-9]+, [0-9]\.?[0-9]+/';
$cmd = "./check_load -w 0,0,0 -c 0,0,0";
$str = `$cmd`;
$t += ok $?>>8,2;
print "Test was: $cmd\n" unless ($?);
-$t += ok $str, '/^CRITICAL - load average: [0-9]\.?[0-9]+, [0-9]\.?[0-9]+, [0-9]\.?[0-9]+$/';
+$t += ok $str, '/^CRITICAL - load average: [0-9]\.?[0-9]+, [0-9]\.?[0-9]+, [0-9]\.?[0-9]+/';
exit(0) if defined($Test::Harness::VERSION);
exit($tests - $t);
index ae2a008771ce5aff3c3a0ef8b27ff506e688e65f..0fae65fee713faed1a4089d1867446ebd03d9265 100644 (file)
--- a/plugins/t/check_mysql.t
+++ b/plugins/t/check_mysql.t
#! /usr/bin/perl -w
use strict;
+use Helper;
use Cache;
use Test;
use vars qw($tests);
-BEGIN {$tests = 1; plan tests => $tests}
+BEGIN {$tests = 2; plan tests => $tests}
exit(0) unless (-x "./check_mysql");
my $str;
my $t;
-$cmd = "./check_mysql -H 127.0.0.1 -P 3306";
+my $mysqlserver = get_option("mysqlserver","host for MYSQL tests");
+
+$cmd = "./check_mysql -H $mysqlserver -P 3306";
$str = `$cmd`;
-$t += ok $?>>8,0;
-print "Test was: $cmd\n" if ($?);
+$t += ok $?>>8,2;
+$t += ok $str, '/Access denied for user: /';
exit(0) if defined($Test::Harness::VERSION);
exit($tests - $t);
diff --git a/test.pl.in b/test.pl.in
index 0b895a31a346b87b8308fc359ab804ee0eae4d75..e88c473d56e41e10b07bac3e06d253c6ddef80c6 100755 (executable)
--- a/test.pl.in
+++ b/test.pl.in
}
use Helper;
-my ($tstdir,$spath,$hostname,$mailhost,$noserver,$nullhost,$quickcheck);
+my ($tstdir,$spath,$hostname,$httphost,$mailhost,$dnshost,$noserver,$nullhost,$quickcheck);
use Getopt::Long;
GetOptions
("tstdir:s"=>\$tstdir,
"spath:s"=>\$spath,
"hostname:s"=>\$hostname,
+ "httpname:s"=>\$httphost,
"mailhost:s"=>\$mailhost,
+ "dnshost:s"=>\$dnshost,
"noserver:s"=>\$noserver,
"nullhost:s"=>\$nullhost,
"quickcheck"=>\$quickcheck);
unless ($quickcheck) {
- $hostname = get_option("hostname","host for FTP/HTTP/UDP tests") unless ($hostname);
+ $hostname = get_option("hostname","host for FTP/UDP tests") unless ($hostname);
+ $httphost = get_option("httphost","host for HTTP tests") unless ($httphost);
$mailhost = get_option("mailhost","host for SMTP/IMAP/POP tests") unless ($mailhost);
+ $dnshost = get_option("dnshost","hostname to lookup for DNS tests") unless ($dnshost);
$noserver = get_option("noserver","host that rejects above services") unless ($noserver);
# This machine should not be locatable from your network. Use IP
# private addresses like 10.x.x.x and pick one that does not exist