From cdc06cc3e2c4670d3cd46b0a03adcf7e6958eff1 Mon Sep 17 00:00:00 2001 From: Peter Bray Date: Mon, 25 Jul 2005 01:47:15 +0000 Subject: [1185704] New Testing Infrastructure. Complete rewrite of the original testing infrastructure and all test cases (to use the new infrastructure) See NPTest.pm and issue 1185704 for more details. git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1207 f882894a-f735-0410-b71e-b25c423dba1c --- plugins/t/check_mysql.t | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) (limited to 'plugins/t/check_mysql.t') diff --git a/plugins/t/check_mysql.t b/plugins/t/check_mysql.t index 0fae65fe..ad423595 100644 --- a/plugins/t/check_mysql.t +++ b/plugins/t/check_mysql.t @@ -1,26 +1,33 @@ -#! /usr/bin/perl -w +#! /usr/bin/perl -w -I .. +# +# MySQL Database Server Tests via check_mysql +# +# $Id$ +# use strict; -use Helper; -use Cache; use Test; +use NPTest; + use vars qw($tests); BEGIN {$tests = 2; plan tests => $tests} -exit(0) unless (-x "./check_mysql"); - -my $null = ''; -my $cmd; -my $str; my $t; -my $mysqlserver = get_option("mysqlserver","host for MYSQL tests"); +my $failureOutput = '/Access denied for user: /'; + +if ( -x "./check_mysql" ) +{ + my $mysqlserver = getTestParameter( "mysql_server", "NP_MYSQL_SERVER", undef, + "A MySQL Server"); -$cmd = "./check_mysql -H $mysqlserver -P 3306"; -$str = `$cmd`; -$t += ok $?>>8,2; -$t += ok $str, '/Access denied for user: /'; + $t += checkCmd( "./check_mysql -H $mysqlserver -P 3306", 2, $failureOutput ); +} +else +{ + $t += skipMissingCmd( "./check_mysql", $tests ); +} exit(0) if defined($Test::Harness::VERSION); exit($tests - $t); -- cgit v1.2.3-74-g34f1