Files
MaxScale/maxscale-system-test/mxs1678_relay_master.cpp
Markus Mäkelä 0808f66aaa Update older mysqlmon tests
Some of the older tests expected results that didn't make much sense. The
mxs1643_extra_events test should expect the master to devolve into the
Running state when it is set into read-only. This is understandable as a
set of servers consisting only of slaves is rather disorienting.

In mxs1678_relay_master breaking the replication of the relay master
devolves it into the Running state as well as all slaves replicating from
it. This is a better result as in a real-life scenario only the valid and
up-to-date slaves would be used.
2018-07-17 11:52:18 +03:00

52 lines
2.2 KiB
C++

/**
* MXS-1678: Stopping IO thread on relay master causes it to be promoted as master
*
* https://jira.mariadb.org/browse/MXS-1678
*/
#include "testconnections.h"
#include <set>
#include <string>
int main(int argc, char** argv)
{
TestConnections test(argc, argv);
test.repl->connect();
execute_query(test.repl->nodes[3], "STOP SLAVE");
execute_query(test.repl->nodes[3], "CHANGE MASTER TO MASTER_HOST='%s', MASTER_PORT=%d",
test.repl->IP_private[2], test.repl->port[2]);
execute_query(test.repl->nodes[3], "START SLAVE");
sleep(5);
StringSet master = {"Master", "Running"};
StringSet slave = {"Slave", "Running"};
StringSet running = {"Running"};
StringSet relay_master = {"Relay Master", "Slave", "Running"};
StringSet relay_master_only = {"Relay Master", "Running"};
test.tprintf("Checking before stopping IO thread");
int exit_code;
char *output = test.maxscales->ssh_node_output(0, "maxadmin list servers", true, &exit_code);
test.tprintf("%s", output);
free(output);
test.add_result(test.maxscales->get_server_status("server1") != master, "server1 is not a master");
test.add_result(test.maxscales->get_server_status("server2") != slave, "server2 is not a slave");
test.add_result(test.maxscales->get_server_status("server3") != relay_master, "server3 is not a relay master");
test.add_result(test.maxscales->get_server_status("server4") != slave, "server4 is not a slave");
execute_query(test.repl->nodes[2], "STOP SLAVE IO_THREAD");
sleep(10);
test.tprintf("Checking after stopping IO thread");
output = test.maxscales->ssh_node_output(0, "maxadmin list servers", true, &exit_code);
test.tprintf("%s", output);
free(output);
test.add_result(test.maxscales->get_server_status("server1") != master, "server1 is not a master");
test.add_result(test.maxscales->get_server_status( "server2") != slave, "server2 is not a slave");
test.add_result(test.maxscales->get_server_status("server3") != running, "server3 is not only running");
test.add_result(test.maxscales->get_server_status("server4") != running, "server4 is not only running");
test.repl->fix_replication();
return test.global_result;
}