Wait for a number of monitor intervals in tests

The tests can now wait for a number of monitor intervals. This removes the
need to have hard-coded sleeps in the code and makes monitor tests more
robust under heavier load.
This commit is contained in:
Markus Mäkelä
2018-06-05 22:06:33 +03:00
parent 7be11af911
commit d0feff5eb3
23 changed files with 152 additions and 86 deletions

View File

@ -525,7 +525,7 @@ void run(TestConnections& test)
while (time(NULL) - start < TEST_DURATION)
{
sleep(FAILOVER_DURATION);
test.maxscales->wait_for_monitor();
int master_id = get_master_server_id(test);
@ -534,20 +534,20 @@ void run(TestConnections& test)
cout << "\nStopping node: " << master_id << endl;
test.repl->stop_node(master_id - 1);
sleep(2 * MONITOR_INTERVAL);
test.maxscales->wait_for_monitor();
list_servers(test);
sleep(FAILOVER_DURATION);
test.maxscales->wait_for_monitor();
list_servers(test);
sleep(FAILOVER_DURATION);
test.maxscales->wait_for_monitor();
cout << "\nStarting node: " << master_id << endl;
test.repl->start_node(master_id - 1);
sleep(2 * MONITOR_INTERVAL);
test.maxscales->wait_for_monitor();
list_servers(test);
sleep(FAILOVER_DURATION);
test.maxscales->wait_for_monitor();
list_servers(test);
}
else
@ -556,7 +556,7 @@ void run(TestConnections& test)
}
}
sleep(FAILOVER_DURATION);
test.maxscales->wait_for_monitor();
cout << "\nStopping clients.\n" << flush;
Client::stop();