diff options
Diffstat (limited to 'plugins/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"); |