diff --git a/system-test/auth_change_user_loop.cpp b/system-test/auth_change_user_loop.cpp index f6bdbd442..08f841d68 100644 --- a/system-test/auth_change_user_loop.cpp +++ b/system-test/auth_change_user_loop.cpp @@ -109,7 +109,8 @@ int main(int argc, char* argv[]) pthread_join(parall_traffic1[j], NULL); } Test->tprintf("All threads are finished"); - Test->repl->flush_hosts(); + // TODO: Just a simple flush_hosts() may be sufficient. + Test->repl->prepare_for_test(); Test->tprintf("Change user to '%s' in order to be able to DROP user", Test->maxscales->user_name); Test->set_timeout(30); diff --git a/system-test/maxtest/include/maxtest/mariadb_nodes.hh b/system-test/maxtest/include/maxtest/mariadb_nodes.hh index a70906ae4..6e9e2b258 100644 --- a/system-test/maxtest/include/maxtest/mariadb_nodes.hh +++ b/system-test/maxtest/include/maxtest/mariadb_nodes.hh @@ -354,10 +354,10 @@ public: std::vector get_all_server_ids_str(); /** - * @brief Execute 'mysqladmin flush-hosts' on all nodes - * @return 0 in case of success + * @brief Flush hosts, adjust settings, remove anonymous users, etc. + * @return True in case of success, false otherwise. */ - int flush_hosts(); + bool prepare_for_test(); /** * @brief Execute query on all nodes diff --git a/system-test/maxtest/src/mariadb_nodes.cc b/system-test/maxtest/src/mariadb_nodes.cc index d698b87a3..05f8b9c12 100644 --- a/system-test/maxtest/src/mariadb_nodes.cc +++ b/system-test/maxtest/src/mariadb_nodes.cc @@ -82,7 +82,7 @@ bool Mariadb_nodes::setup() { read_env(); truncate_mariadb_logs(); - flush_hosts(); + prepare_for_test(); close_active_connections(); return true; @@ -874,7 +874,7 @@ bool Mariadb_nodes::fix_replication() if (check_replication() == 0) { cout << "Replication is fixed" << endl; - rval = flush_hosts(); + rval = prepare_for_test(); } else { @@ -1028,7 +1028,7 @@ std::vector Mariadb_nodes::get_all_server_ids() return rval; } -bool do_flush_hosts(MYSQL* conn) +bool do_prepare_for_test(MYSQL* conn) { int local_result = 0; @@ -1088,11 +1088,11 @@ bool do_flush_hosts(MYSQL* conn) return local_result == 0; } -int Mariadb_nodes::flush_hosts() +bool Mariadb_nodes::prepare_for_test() { if (this->nodes[0] == NULL && (this->connect() != 0)) { - return 1; + return false; } bool all_ok = true; @@ -1100,7 +1100,7 @@ int Mariadb_nodes::flush_hosts() for (int i = 0; i < N; i++) { - std::packaged_task task(do_flush_hosts); + std::packaged_task task(do_prepare_for_test); futures.push_back(task.get_future()); std::thread(std::move(task), nodes[i]).detach(); } diff --git a/system-test/mxs321.cpp b/system-test/mxs321.cpp index 9fc838745..c30b05e9c 100644 --- a/system-test/mxs321.cpp +++ b/system-test/mxs321.cpp @@ -107,7 +107,8 @@ int main(int argc, char* argv[]) /** Create connections to readconnroute slave */ create_and_check_connections(Test, 3); - Test->repl->flush_hosts(); + // TODO: Just a simple flush_hosts() may be sufficient. + Test->repl->prepare_for_test(); int rval = Test->global_result; delete Test; diff --git a/system-test/mxs548_short_session_change_user.cpp b/system-test/mxs548_short_session_change_user.cpp index 6a8ea0d76..bbe3c73dd 100644 --- a/system-test/mxs548_short_session_change_user.cpp +++ b/system-test/mxs548_short_session_change_user.cpp @@ -83,7 +83,8 @@ int main(int argc, char** argv) test.tprintf("Flushing backend hosts"); test.set_timeout(60); - test.repl->flush_hosts(); + // TODO: Just a simple flush_hosts() may be sufficient. + test.repl->prepare_for_test(); test.tprintf("Dropping tables and users"); test.set_timeout(60); diff --git a/system-test/mxs559_block_master.cpp b/system-test/mxs559_block_master.cpp index 0e3c5e815..81f6a6c6c 100644 --- a/system-test/mxs559_block_master.cpp +++ b/system-test/mxs559_block_master.cpp @@ -87,7 +87,8 @@ int main(int argc, char* argv[]) test.stop_timeout(); test.tprintf("Make sure that replication works"); - test.repl->flush_hosts(); + // TODO: Just a simple flush_hosts() may be sufficient. + test.repl->prepare_for_test(); if (!test.repl->fix_replication()) { test.tprintf("Replication is broken!"); diff --git a/system-test/rwsplit_readonly.cpp b/system-test/rwsplit_readonly.cpp index cf0a00c40..217f81e37 100644 --- a/system-test/rwsplit_readonly.cpp +++ b/system-test/rwsplit_readonly.cpp @@ -278,7 +278,7 @@ int main(int argc, char* argv[]) Test->repl->disconnect(); /** Clean up test environment */ - Test->repl->flush_hosts(); + Test->repl->prepare_for_test(); int rval = Test->global_result; delete Test; return rval; diff --git a/system-test/rwsplit_readonly_stress.cpp b/system-test/rwsplit_readonly_stress.cpp index aab4c0f40..54efedf1c 100644 --- a/system-test/rwsplit_readonly_stress.cpp +++ b/system-test/rwsplit_readonly_stress.cpp @@ -112,7 +112,7 @@ int main(int argc, char* argv[]) } /** Clean up test environment */ - Test->repl->flush_hosts(); + Test->repl->prepare_for_test(); int rval = Test->global_result; delete Test; return rval;