summaryrefslogtreecommitdiffstats
path: root/plugins/t/check_mysql.t
diff options
context:
space:
mode:
authorThomas Guyot-Sionnest <dermoth@users.sourceforge.net>2008-04-30 12:50:52 +0000
committerThomas Guyot-Sionnest <dermoth@users.sourceforge.net>2008-04-30 12:50:52 +0000
commitaca1e6a6cec40754c67d3cf229db2660c4685202 (patch)
treef9093f5eefea0dcf6745a6a92e17b74950a1efa3 /plugins/t/check_mysql.t
parent6f2ee45c932dfec9d9a1e651b39d18f98b2ef009 (diff)
downloadmonitoring-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.t22
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);
19 19
20plan skip_all => "check_mysql not compiled" unless (-x "check_mysql"); 20plan skip_all => "check_mysql not compiled" unless (-x "check_mysql");
21 21
22plan tests => 10; 22plan tests => 15;
23 23
24my $bad_login_output = '/Access denied for user /'; 24my $bad_login_output = '/Access denied for user /';
25my $mysqlserver = getTestParameter( 25my $mysqlserver = getTestParameter(
26 "NP_MYSQL_SERVER", 26 "NP_MYSQL_SERVER",
27 "A MySQL Server with no slaves setup" 27 "A MySQL Server hostname or IP with no slaves setup"
28 );
29my $mysqlsocket = getTestParameter(
30 "NP_MYSQL_SOCKET",
31 "A MySQL Server socket with no slaves setup"
28 ); 32 );
29my $mysql_login_details = getTestParameter( 33my $mysql_login_details = getTestParameter(
30 "MYSQL_LOGIN_DETAILS", 34 "MYSQL_LOGIN_DETAILS",
@@ -58,6 +62,20 @@ SKIP: {
58} 62}
59 63
60SKIP: { 64SKIP: {
65 skip "No mysql socket defined", 5 unless $mysqlsocket;
66 $result = NPTest->testCmd("./check_mysql -s $mysqlsocket $mysql_login_details");
67 cmp_ok( $result->return_code, '==', 0, "Login okay");
68
69 $result = NPTest->testCmd("./check_mysql -s $mysqlsocket -u dummy -pdummy");
70 cmp_ok( $result->return_code, '==', 2, "Login failure");
71 like( $result->output, $bad_login_output, "Expected login failure message");
72
73 $result = NPTest->testCmd("./check_mysql -S -s $mysqlsocket $mysql_login_details");
74 cmp_ok( $result->return_code, "==", 1, "No slaves defined" );
75 like( $result->output, "/No slaves defined/", "Correct error message");
76}
77
78SKIP: {
61 skip "No mysql server with slaves defined", 5 unless $with_slave; 79 skip "No mysql server with slaves defined", 5 unless $with_slave;
62 $result = NPTest->testCmd("./check_mysql -H $with_slave $with_slave_login"); 80 $result = NPTest->testCmd("./check_mysql -H $with_slave $with_slave_login");
63 cmp_ok( $result->return_code, '==', 0, "Login okay"); 81 cmp_ok( $result->return_code, '==', 0, "Login okay");