From 6601f15ff849e07d30ed06fd18f0b432a7e6e11d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Mon, 25 Sep 2017 13:27:36 +0300 Subject: [PATCH] MXS-1451: Add test case Added test case for MXS-1451 that reproduces the problem. --- maxscale-system-test/CMakeLists.txt | 4 + .../maxscale.cnf.template.mxs1451_skip_auth | 89 +++++++++++++++++++ maxscale-system-test/mxs1451_skip_auth.cpp | 34 +++++++ 3 files changed, 127 insertions(+) create mode 100644 maxscale-system-test/cnf/maxscale.cnf.template.mxs1451_skip_auth create mode 100644 maxscale-system-test/mxs1451_skip_auth.cpp diff --git a/maxscale-system-test/CMakeLists.txt b/maxscale-system-test/CMakeLists.txt index 1011f301e..66b2315e2 100644 --- a/maxscale-system-test/CMakeLists.txt +++ b/maxscale-system-test/CMakeLists.txt @@ -494,6 +494,10 @@ add_test_executable(mxs1418.cpp mxs1418 replication LABELS maxscale REPL_BACKEND # https://jira.mariadb.org/browse/MXS-1295 add_test_executable(mxs1295_sp_call.cpp mxs1295_sp_call mxs1295 LABELS maxscale REPL_BACKEND) +# MXS-1451: Password is not stored with skip_authentication=true +# https://jira.mariadb.org/browse/MXS-1451 +add_test_executable(mxs1451_skip_auth.cpp mxs1451_skip_auth mxs1451_skip_auth LABELS maxscale REPL_BACKEND) + # 'namedserverfilter' test add_test_executable(namedserverfilter.cpp namedserverfilter namedserverfilter LABELS namedserverfilter LIGHT REPL_BACKEND) diff --git a/maxscale-system-test/cnf/maxscale.cnf.template.mxs1451_skip_auth b/maxscale-system-test/cnf/maxscale.cnf.template.mxs1451_skip_auth new file mode 100644 index 000000000..43df64165 --- /dev/null +++ b/maxscale-system-test/cnf/maxscale.cnf.template.mxs1451_skip_auth @@ -0,0 +1,89 @@ +[maxscale] +threads=###threads### + +[MySQL Monitor] +type=monitor +module=mysqlmon +###repl51### +servers=server1,server2,server3,server4 +user=maxskysql +passwd=skysql +monitor_interval=1000 + +[RW Split Router] +type=service +router=readwritesplit +servers=server1,server2,server3,server4 +user=maxskysql +passwd=skysql + +[Read Connection Router Slave] +type=service +router=readconnroute +router_options=slave +servers=server1,server2,server3,server4 +user=maxskysql +passwd=skysql + +[Read Connection Router Master] +type=service +router=readconnroute +router_options=master +servers=server1,server2,server3,server4 +user=maxskysql +passwd=skysql + +[RW Split Listener] +type=listener +service=RW Split Router +protocol=MySQLClient +port=4006 +authenticator_options=skip_authentication=true + +[Read Connection Listener Slave] +type=listener +service=Read Connection Router Slave +protocol=MySQLClient +port=4009 +authenticator_options=skip_authentication=true + +[Read Connection Listener Master] +type=listener +service=Read Connection Router Master +protocol=MySQLClient +port=4008 +authenticator_options=skip_authentication=true + +[CLI] +type=service +router=cli + +[CLI Listener] +type=listener +service=CLI +protocol=maxscaled +socket=default + +[server1] +type=server +address=###node_server_IP_1### +port=###node_server_port_1### +protocol=MySQLBackend + +[server2] +type=server +address=###node_server_IP_2### +port=###node_server_port_2### +protocol=MySQLBackend + +[server3] +type=server +address=###node_server_IP_3### +port=###node_server_port_3### +protocol=MySQLBackend + +[server4] +type=server +address=###node_server_IP_4### +port=###node_server_port_4### +protocol=MySQLBackend diff --git a/maxscale-system-test/mxs1451_skip_auth.cpp b/maxscale-system-test/mxs1451_skip_auth.cpp new file mode 100644 index 000000000..55e16dbc0 --- /dev/null +++ b/maxscale-system-test/mxs1451_skip_auth.cpp @@ -0,0 +1,34 @@ +/** + * MXS-1451: Password is not stored with skip_authentication=true + * + * Check that connection through MaxScale work even if authentication is disabled + */ + +#include "testconnections.h" + +int main(int argc, char *argv[]) +{ + TestConnections test(argc, argv); + + test.set_timeout(60); + test.tprintf("Creating user..."); + test.repl->connect(); + execute_query(test.repl->nodes[0], "CREATE USER 'auth_test'@'%s' IDENTIFIED BY 'test'", test.maxscale_ip()); + execute_query(test.repl->nodes[0], "GRANT ALL ON *.* to 'auth_test'@'%s'", test.maxscale_ip()); + test.repl->sync_slaves(); + test.repl->close_connections(); + + test.set_timeout(60); + test.tprintf("Trying to connect through MaxScale"); + MYSQL* conn = open_conn_db(test.rwsplit_port, test.maxscale_ip(), "test", "auth_test", "test", false); + test.try_query(conn, "SHOW DATABASES"); + mysql_close(conn); + + test.set_timeout(60); + test.tprintf("Dropping user"); + test.repl->connect(); + execute_query(test.repl->nodes[0], "DROP USER 'auth_test'@'%s'", test.maxscale_ip()); + test.repl->close_connections(); + + return test.global_result; +}