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); | |||
19 | 19 | ||
20 | plan skip_all => "check_mysql not compiled" unless (-x "check_mysql"); | 20 | plan skip_all => "check_mysql not compiled" unless (-x "check_mysql"); |
21 | 21 | ||
22 | plan tests => 10; | 22 | plan tests => 15; |
23 | 23 | ||
24 | my $bad_login_output = '/Access denied for user /'; | 24 | my $bad_login_output = '/Access denied for user /'; |
25 | my $mysqlserver = getTestParameter( | 25 | my $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 | ); | ||
29 | my $mysqlsocket = getTestParameter( | ||
30 | "NP_MYSQL_SOCKET", | ||
31 | "A MySQL Server socket with no slaves setup" | ||
28 | ); | 32 | ); |
29 | my $mysql_login_details = getTestParameter( | 33 | my $mysql_login_details = getTestParameter( |
30 | "MYSQL_LOGIN_DETAILS", | 34 | "MYSQL_LOGIN_DETAILS", |
@@ -58,6 +62,20 @@ SKIP: { | |||
58 | } | 62 | } |
59 | 63 | ||
60 | SKIP: { | 64 | SKIP: { |
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 | |||
78 | SKIP: { | ||
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"); |