From 8470da9313da4aeb59837b09635580950dc73aa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Fri, 6 Jul 2018 17:14:22 +0300 Subject: [PATCH] Fix failing tests Changed mxs1719 to expect a failure with the query and added monitor waits to mxs359_read_only. --- maxscale-system-test/mxs1719.cpp | 7 +++++-- maxscale-system-test/mxs359_read_only.cpp | 12 ++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/maxscale-system-test/mxs1719.cpp b/maxscale-system-test/mxs1719.cpp index c5fbff9e9..43859ecbe 100644 --- a/maxscale-system-test/mxs1719.cpp +++ b/maxscale-system-test/mxs1719.cpp @@ -42,8 +42,10 @@ void run(TestConnections& test) if (mysql_real_connect(pMysql, test.maxscales->IP[0], zUser, zPassword, "test", port, NULL, CLIENT_MULTI_STATEMENTS)) { - // One multi-statement with two UPDATEs. - test.try_query(pMysql, "UPDATE MXS_1719 SET a=1; UPDATE MXS_1719 SET a=1;"); + const char* q = "UPDATE MXS_1719 SET a=1; UPDATE MXS_1719 SET a=1;"; + // One multi-statement with two UPDATEs. Note: This query should fail + // with 2.3 now that function blocking has been added + test.assert(execute_query_silent(pMysql, q) != 0, "Query '%s' should not succeed", q); // Sleep a while, so that the log is flushed. sleep(5); @@ -54,6 +56,7 @@ void run(TestConnections& test) // This will hang immediately, so we can shorten the timeout. test.set_timeout(5); test.try_query(pMysql, "SELECT * FROM MXS_1719"); + test.stop_timeout(); } else { diff --git a/maxscale-system-test/mxs359_read_only.cpp b/maxscale-system-test/mxs359_read_only.cpp index a07857a38..6f06ab44c 100644 --- a/maxscale-system-test/mxs359_read_only.cpp +++ b/maxscale-system-test/mxs359_read_only.cpp @@ -37,14 +37,14 @@ void test_replaced_master(TestConnections& test, std::ostream& out) test.try_query(test.maxscales->conn_rwsplit[0], "SELECT * FROM test.t1"); test.repl->block_node(0); - sleep(10); + test.maxscales->wait_for_monitor(); out << "Reads should still work even if no master is available" << endl; test.try_query(test.maxscales->conn_rwsplit[0], "SELECT * FROM test.t1"); test.repl->unblock_node(0); change_master(1, 0); - sleep(10); + test.maxscales->wait_for_monitor(); out << "Reads and writes after master change should work" << endl; test.try_query(test.maxscales->conn_rwsplit[0], "INSERT INTO test.t1 VALUES (2)"); @@ -58,14 +58,14 @@ void test_new_master(TestConnections& test, std::ostream& out) { out << "Block the master before connecting" << endl; test.repl->block_node(0); - sleep(10); + test.maxscales->wait_for_monitor(); out << "Connect and check that read-only mode works" << endl; test.maxscales->connect(); test.try_query(test.maxscales->conn_rwsplit[0], "SELECT * FROM test.t1"); change_master(1, 0); - sleep(10); + test.maxscales->wait_for_monitor(); out << "Both reads and writes after master change should work" << endl; test.try_query(test.maxscales->conn_rwsplit[0], "INSERT INTO test.t1 VALUES (2)"); @@ -84,7 +84,7 @@ void test_master_failure(TestConnections& test, std::ostream& out) test.try_query(test.maxscales->conn_rwsplit[0], "SELECT * FROM test.t1"); test.repl->block_node(0); - sleep(10); + test.maxscales->wait_for_monitor(); out << "Reads should still work even if no master is available" << endl; test.try_query(test.maxscales->conn_rwsplit[0], "SELECT * FROM test.t1"); @@ -122,7 +122,7 @@ int main(int argc, char** argv) i.func(test, out); if (test.global_result) { - test.tprintf("Test '%s' failed: %s", i.description, out.str().c_str()); + test.tprintf("Test '%s' failed: \n\n%s\n\n", i.description, out.str().c_str()); break; } }