Fix test failures

Added timeouts to maxinfo_sql and mysqlmon_failover_stress, fixed
fwf_syntax to work with out-of-source test runs.
This commit is contained in:
Markus Mäkelä
2018-07-30 11:43:59 +03:00
parent ad5762a2fb
commit 28e55b260f
3 changed files with 14 additions and 1 deletions

View File

@ -9,6 +9,7 @@
#include <iostream> #include <iostream>
#include <unistd.h> #include <unistd.h>
#include <linux/limits.h>
#include "testconnections.h" #include "testconnections.h"
#include "fw_copy_rules.h" #include "fw_copy_rules.h"
@ -65,10 +66,12 @@ int main(int argc, char** argv)
/** Create rule file with syntax error */ /** Create rule file with syntax error */
truncate(temp_rules, 0); truncate(temp_rules, 0);
create_rule(rules_failure[i], users_ok[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.tprintf("Testing rule: %s\n", rules_failure[i]);
test.add_result(test.maxscales->start_maxscale(0) == 0, "MaxScale should fail to start"); 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 /** Check that MaxScale did not start and that the log contains
* a message about the syntax error. */ * a message about the syntax error. */

View File

@ -61,20 +61,27 @@ int main(int argc, char** argv)
for (int i = 0; i < 100; i++) for (int i = 0; i < 100; i++)
{ {
test.set_timeout(60);
for (auto a : commands) for (auto a : commands)
{ {
test.try_query(conn, "%s", a.c_str()); test.try_query(conn, "%s", a.c_str());
} }
} }
test.stop_timeout();
mysql_close(conn); mysql_close(conn);
run = false; run = false;
test.set_timeout(60);
for (auto& a : threads) for (auto& a : threads)
{ {
a.join(); a.join();
} }
test.stop_timeout();
return test.global_result; return test.global_result;
} }

View File

@ -515,12 +515,14 @@ void run(TestConnections& test)
while (time(NULL) - start < TEST_DURATION) while (time(NULL) - start < TEST_DURATION)
{ {
test.set_timeout(20);
test.maxscales->wait_for_monitor(); test.maxscales->wait_for_monitor();
int master_id = get_master_server_id(test); int master_id = get_master_server_id(test);
if (master_id > 0 && master_id <= 4) if (master_id > 0 && master_id <= 4)
{ {
test.set_timeout(20);
cout << "\nStopping node: " << master_id << endl; cout << "\nStopping node: " << master_id << endl;
test.repl->stop_node(master_id - 1); test.repl->stop_node(master_id - 1);
@ -530,6 +532,7 @@ void run(TestConnections& test)
test.maxscales->wait_for_monitor(); test.maxscales->wait_for_monitor();
list_servers(test); list_servers(test);
test.set_timeout(20);
test.maxscales->wait_for_monitor(); test.maxscales->wait_for_monitor();
cout << "\nStarting node: " << master_id << endl; cout << "\nStarting node: " << master_id << endl;
test.repl->start_node(master_id - 1); test.repl->start_node(master_id - 1);