From 8ebac86406c307e4e3f0d6aa8510698c0092b248 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Wed, 31 Jan 2018 11:03:17 +0200 Subject: [PATCH] Simplify mxs431 The test unnecessarily restarted MaxScale for no obvious reason. Cleaned up SQL queries to use new functionality. --- maxscale-system-test/mxs431.cpp | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/maxscale-system-test/mxs431.cpp b/maxscale-system-test/mxs431.cpp index 62e0dcb5d..f179f26ef 100644 --- a/maxscale-system-test/mxs431.cpp +++ b/maxscale-system-test/mxs431.cpp @@ -10,37 +10,26 @@ int main(int argc, char *argv[]) { TestConnections test(argc, argv); - char str[256]; - int iterations = 100; - test.repl->execute_query_all_nodes((char *) "set global max_connections = 600;"); - test.set_timeout(200); - test.repl->stop_slaves(); - test.set_timeout(200); - test.maxscales->restart_maxscale(0); - test.set_timeout(200); + test.repl->connect(); - test.stop_timeout(); /** Create a database on each node */ for (int i = 0; i < test.repl->N; i++) { test.set_timeout(20); - sprintf(str, "DROP DATABASE IF EXISTS shard_db%d", i); - test.tprintf("%s\n", str); - execute_query(test.repl->nodes[i], str); - test.set_timeout(20); - sprintf(str, "CREATE DATABASE shard_db%d", i); - test.tprintf("%s\n", str); - execute_query(test.repl->nodes[i], str); + execute_query(test.repl->nodes[i], "set global max_connections = 600"); + execute_query(test.repl->nodes[i], "DROP DATABASE IF EXISTS shard_db%d", i); + execute_query(test.repl->nodes[i], "CREATE DATABASE shard_db%d", i); test.stop_timeout(); } - test.repl->close_connections(); + int iterations = 100; for (int j = 0; j < iterations && test.global_result == 0; j++) { for (int i = 0; i < test.repl->N && test.global_result == 0; i++) { + char str[256]; sprintf(str, "shard_db%d", i); test.set_timeout(30); MYSQL *conn = open_conn_db(test.maxscales->rwsplit_port[0], test.maxscales->IP[0], @@ -52,5 +41,13 @@ int main(int argc, char *argv[]) } } + /** Create a database on each node */ + for (int i = 0; i < test.repl->N; i++) + { + test.set_timeout(20); + execute_query(test.repl->nodes[i], "DROP DATABASE shard_db%d", i); + test.stop_timeout(); + } + return test.global_result; }