diff options
author | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | 2008-04-30 12:50:52 +0000 |
---|---|---|
committer | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | 2008-04-30 12:50:52 +0000 |
commit | aca1e6a6cec40754c67d3cf229db2660c4685202 (patch) | |
tree | f9093f5eefea0dcf6745a6a92e17b74950a1efa3 /plugins/t/check_mysql.t | |
parent | 6f2ee45c932dfec9d9a1e651b39d18f98b2ef009 (diff) | |
download | monitoring-plugins-aca1e6a6cec40754c67d3cf229db2660c4685202.tar.gz |
Add socket support to check_mysql*
Also clears the password from check_mysql command-line options
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1988 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/t/check_mysql.t')
-rw-r--r-- | plugins/t/check_mysql.t | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/plugins/t/check_mysql.t b/plugins/t/check_mysql.t index 852926a7..e8bccf1c 100644 --- a/plugins/t/check_mysql.t +++ b/plugins/t/check_mysql.t @@ -19,12 +19,16 @@ use vars qw($tests); plan skip_all => "check_mysql not compiled" unless (-x "check_mysql"); -plan tests => 10; +plan tests => 15; my $bad_login_output = '/Access denied for user /'; my $mysqlserver = getTestParameter( "NP_MYSQL_SERVER", - "A MySQL Server with no slaves setup" + "A MySQL Server hostname or IP with no slaves setup" + ); +my $mysqlsocket = getTestParameter( + "NP_MYSQL_SOCKET", + "A MySQL Server socket with no slaves setup" ); my $mysql_login_details = getTestParameter( "MYSQL_LOGIN_DETAILS", @@ -58,6 +62,20 @@ SKIP: { } SKIP: { + skip "No mysql socket defined", 5 unless $mysqlsocket; + $result = NPTest->testCmd("./check_mysql -s $mysqlsocket $mysql_login_details"); + cmp_ok( $result->return_code, '==', 0, "Login okay"); + + $result = NPTest->testCmd("./check_mysql -s $mysqlsocket -u dummy -pdummy"); + cmp_ok( $result->return_code, '==', 2, "Login failure"); + like( $result->output, $bad_login_output, "Expected login failure message"); + + $result = NPTest->testCmd("./check_mysql -S -s $mysqlsocket $mysql_login_details"); + cmp_ok( $result->return_code, "==", 1, "No slaves defined" ); + like( $result->output, "/No slaves defined/", "Correct error message"); +} + +SKIP: { skip "No mysql server with slaves defined", 5 unless $with_slave; $result = NPTest->testCmd("./check_mysql -H $with_slave $with_slave_login"); cmp_ok( $result->return_code, '==', 0, "Login okay"); |