Use wait_for_monitor in mxs1643_extra_events

Replace hard-coded sleeps in mxs1643_extra_events with
Maxscales::wait_for_monitor.
This commit is contained in:
Markus Mäkelä
2018-06-27 00:11:12 +03:00
parent f49c31625d
commit b7fdaf0340

View File

@ -14,18 +14,18 @@ int main(int argc, char** argv)
test.tprintf("Set master into read-only mode"); test.tprintf("Set master into read-only mode");
test.repl->connect(); test.repl->connect();
execute_query(test.repl->nodes[0], "SET GLOBAL read_only=ON"); execute_query(test.repl->nodes[0], "SET GLOBAL read_only=ON");
sleep(10); test.maxscales->wait_for_monitor();
test.tprintf("Check that the current master now has the slave label"); test.tprintf("Check that the current master now has the slave label");
test.check_log_err(0, "[Master, Running] -> [Running]", false); test.check_log_err(0, "[Master, Running] -> [Running]", false);
test.check_log_err(0, "[Master, Running] -> [Slave, Running]", true); test.check_log_err(0, "[Master, Running] -> [Slave, Running]", true);
execute_query(test.repl->nodes[0], "SET GLOBAL read_only=OFF"); execute_query(test.repl->nodes[0], "SET GLOBAL read_only=OFF");
sleep(5); test.maxscales->wait_for_monitor();
test.maxscales->ssh_node_f(0, true, "truncate -s 0 /var/log/maxscale/maxscale.log"); test.maxscales->ssh_node_f(0, true, "truncate -s 0 /var/log/maxscale/maxscale.log");
// Check that the Master and Slave status aren't both set // Check that the Master and Slave status aren't both set
test.tprintf("Block master and wait for monitor to detect it."); test.tprintf("Block master and wait for monitor to detect it.");
test.repl->block_node(0); test.repl->block_node(0);
sleep(10); test.maxscales->wait_for_monitor();
test.tprintf("Check that the new master doesn't have both slave and master labels"); test.tprintf("Check that the new master doesn't have both slave and master labels");
test.check_log_err(0, "[Slave, Running] -> [Master, Slave, Running]", false); test.check_log_err(0, "[Slave, Running] -> [Master, Slave, Running]", false);
test.check_log_err(0, "[Slave, Running] -> [Master, Running]", true); test.check_log_err(0, "[Slave, Running] -> [Master, Running]", true);