From 28e55b260fca8d149e68145a69aab16fe1752519 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Mon, 30 Jul 2018 11:43:59 +0300 Subject: [PATCH] Fix test failures Added timeouts to maxinfo_sql and mysqlmon_failover_stress, fixed fwf_syntax to work with out-of-source test runs. --- maxscale-system-test/fwf_syntax.cpp | 5 ++++- maxscale-system-test/maxinfo_sql.cpp | 7 +++++++ maxscale-system-test/mysqlmon_failover_stress.cpp | 3 +++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/maxscale-system-test/fwf_syntax.cpp b/maxscale-system-test/fwf_syntax.cpp index 04df1a428..5f74a1d08 100644 --- a/maxscale-system-test/fwf_syntax.cpp +++ b/maxscale-system-test/fwf_syntax.cpp @@ -9,6 +9,7 @@ #include #include +#include #include "testconnections.h" #include "fw_copy_rules.h" @@ -65,10 +66,12 @@ int main(int argc, char** argv) /** Create rule file with syntax error */ truncate(temp_rules, 0); create_rule(rules_failure[i], users_ok[0]); - copy_rules(&test, (char*)temp_rules, (char*)test_dir); + char buf[PATH_MAX + 1]; + copy_rules(&test, (char*)temp_rules, (char*)getcwd(buf, sizeof(buf))); test.tprintf("Testing rule: %s\n", rules_failure[i]); test.add_result(test.maxscales->start_maxscale(0) == 0, "MaxScale should fail to start"); + test.maxscales->stop_maxscale(0); /** Check that MaxScale did not start and that the log contains * a message about the syntax error. */ diff --git a/maxscale-system-test/maxinfo_sql.cpp b/maxscale-system-test/maxinfo_sql.cpp index f651b3faa..a83b91cb8 100644 --- a/maxscale-system-test/maxinfo_sql.cpp +++ b/maxscale-system-test/maxinfo_sql.cpp @@ -61,20 +61,27 @@ int main(int argc, char** argv) for (int i = 0; i < 100; i++) { + test.set_timeout(60); for (auto a : commands) { test.try_query(conn, "%s", a.c_str()); } } + test.stop_timeout(); + mysql_close(conn); run = false; + test.set_timeout(60); + for (auto& a : threads) { a.join(); } + test.stop_timeout(); + return test.global_result; } diff --git a/maxscale-system-test/mysqlmon_failover_stress.cpp b/maxscale-system-test/mysqlmon_failover_stress.cpp index 9031fff16..eddbd572e 100755 --- a/maxscale-system-test/mysqlmon_failover_stress.cpp +++ b/maxscale-system-test/mysqlmon_failover_stress.cpp @@ -515,12 +515,14 @@ void run(TestConnections& test) while (time(NULL) - start < TEST_DURATION) { + test.set_timeout(20); test.maxscales->wait_for_monitor(); int master_id = get_master_server_id(test); if (master_id > 0 && master_id <= 4) { + test.set_timeout(20); cout << "\nStopping node: " << master_id << endl; test.repl->stop_node(master_id - 1); @@ -530,6 +532,7 @@ void run(TestConnections& test) test.maxscales->wait_for_monitor(); list_servers(test); + test.set_timeout(20); test.maxscales->wait_for_monitor(); cout << "\nStarting node: " << master_id << endl; test.repl->start_node(master_id - 1);