From 151c7e19f472fd63d91095534cbe7c1f3edbb49f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Mon, 9 Jul 2018 14:20:18 +0300 Subject: [PATCH] Add schemarouter reconfiguration test Extended the alter_router test to check that modifications to schemarouter are processed correctly. --- maxscale-system-test/CMakeLists.txt | 2 +- maxscale-system-test/alter_router.cpp | 16 ++++ .../cnf/maxscale.cnf.template.alter_router | 88 +++++++++++++++++++ 3 files changed, 105 insertions(+), 1 deletion(-) create mode 100755 maxscale-system-test/cnf/maxscale.cnf.template.alter_router diff --git a/maxscale-system-test/CMakeLists.txt b/maxscale-system-test/CMakeLists.txt index 050eb8fb4..6430f64d1 100644 --- a/maxscale-system-test/CMakeLists.txt +++ b/maxscale-system-test/CMakeLists.txt @@ -525,7 +525,7 @@ add_test_executable(mxs922_scaling.cpp mxs922_scaling mxs922_base LABELS maxscal add_test_executable(mxs922_listener_ssl.cpp mxs922_listener_ssl mxs922_base LABELS maxscale REPL_BACKEND) # Alter routers at runtime -add_test_executable(alter_router.cpp alter_router replication LABELS maxscale REPL_BACKEND) +add_test_executable(alter_router.cpp alter_router alter_router LABELS maxscale REPL_BACKEND) # Test of MaxRows filter add_test_executable(mxs1071_maxrows.cpp mxs1071_maxrows maxrows LABELS maxrowsfilter REPL_BACKEND) diff --git a/maxscale-system-test/alter_router.cpp b/maxscale-system-test/alter_router.cpp index 0dd5ecacb..e84349117 100644 --- a/maxscale-system-test/alter_router.cpp +++ b/maxscale-system-test/alter_router.cpp @@ -88,6 +88,21 @@ void alter_readconnroute(TestConnections& test) } } +void alter_schemarouter(TestConnections& test) +{ + Connection conn = test.maxscales->readconn_slave(); + conn.connect(); + test.assert(!conn.query("SELECT 1"), "Query before reconfiguration should fail"); + conn.disconnect(); + + int rc = test.maxscales->ssh_node_f(0, true, "maxctrl alter service SchemaRouter ignore_databases_regex '.*'"); + test.assert(rc == 0, "Schemarouter alteration should work"); + + conn.connect(); + test.assert(conn.query("SELECT 1"), "Query after reconfiguration should work: %s", conn.error()); + conn.disconnect(); +} + void alter_unsupported(TestConnections& test) { int rc = test.maxscales->ssh_node_f(0, true, "maxctrl alter service RW-Split-Router unknown parameter"); @@ -104,6 +119,7 @@ int main(int argc, char** argv) { TEST(alter_readwritesplit), TEST(alter_readconnroute), + TEST(alter_schemarouter), TEST(alter_unsupported) }; diff --git a/maxscale-system-test/cnf/maxscale.cnf.template.alter_router b/maxscale-system-test/cnf/maxscale.cnf.template.alter_router new file mode 100755 index 000000000..a105f96e0 --- /dev/null +++ b/maxscale-system-test/cnf/maxscale.cnf.template.alter_router @@ -0,0 +1,88 @@ +[maxscale] +threads=###threads### + +[MySQL-Monitor] +type=monitor +module=mysqlmon +servers=server1,server2,server3,server4 +user=maxskysql +passwd=skysql +monitor_interval=1000 +detect_stale_master=false +detect_standalone_master=false + +[RW-Split-Router] +type=service +router=readwritesplit +servers=server1,server2,server3,server4 +user=maxskysql +passwd=skysql +router_options=slave_selection_criteria=LEAST_GLOBAL_CONNECTIONS +max_slave_connections=1 + +[Read-Connection-Router-Master] +type=service +router=readconnroute +router_options=master +servers=server1,server2,server3,server4 +user=maxskysql +passwd=skysql + +[SchemaRouter] +type=service +router=schemarouter +servers=server1,server2,server3,server4 +user=maxskysql +passwd=skysql + +[RW-Split-Listener] +type=listener +service=RW-Split-Router +protocol=MySQLClient +port=4006 + +[Read-Connection-Listener-Master] +type=listener +service=Read-Connection-Router-Master +protocol=MySQLClient +port=4008 + +[SchemaRouter-Listener] +type=listener +service=SchemaRouter +protocol=MySQLClient +port=4009 + +[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