Fix failover_mysqlmon

The test should stop MaxScale when it is fixing the replication to prevent
the triggering of the standalone master detection.

Also removed leading spaces from the messages and fixed a possible crash with a
NULL value given to `ssh_node`.
This commit is contained in:
Markus Mäkelä 2018-03-19 10:26:02 +02:00
parent 64ccb67897
commit 02368473f7
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19
2 changed files with 10 additions and 11 deletions

View File

@ -17,7 +17,7 @@ int main(int argc, char *argv[])
{
TestConnections * test = new TestConnections(argc, argv);
test->tprintf(" Create the test table and insert some data ");
test->tprintf("Create the test table and insert some data ");
test->connect_maxscale();
test->try_query(test->conn_rwsplit, "CREATE OR REPLACE TABLE test.t1 (id int)");
test->try_query(test->conn_rwsplit, "INSERT INTO test.t1 VALUES (1)");
@ -26,16 +26,16 @@ int main(int argc, char *argv[])
test->repl->connect();
test->repl->sync_slaves();
test->tprintf(" Block all but one node ");
test->tprintf("Block all but one node ");
test->repl->block_node(0);
test->repl->block_node(1);
test->repl->block_node(2);
execute_query(test->repl->nodes[3], "STOP SLAVE;RESET SLAVE ALL;");
test->tprintf(" Wait for the monitor to detect it ");
test->tprintf("Wait for the monitor to detect it ");
sleep(15);
test->tprintf(" Connect and insert should work ");
test->tprintf("Connect and insert should work ");
char *output = test->ssh_maxscale_output(true, "maxadmin list servers");
test->tprintf("%s", output);
free(output);
@ -43,12 +43,12 @@ int main(int argc, char *argv[])
test->try_query(test->conn_rwsplit, "INSERT INTO test.t1 VALUES (1)");
test->close_maxscale_connections();
test->tprintf(" Unblock nodes ");
test->tprintf("Unblock nodes ");
test->repl->unblock_node(0);
test->repl->unblock_node(1);
test->repl->unblock_node(2);
test->tprintf(" Wait for the monitor to detect it ");
test->tprintf("Wait for the monitor to detect it ");
sleep(15);
test->tprintf("Check that we are still using the last node to which we failed over "
@ -64,12 +64,11 @@ int main(int argc, char *argv[])
"@@server_id is different: %s != %s", maxscale_id, real_id);
test->close_maxscale_connections();
test->ssh_maxscale(true, "maxadmin clear server server1 maintenance");
test->ssh_maxscale(true, "maxadmin clear server server2 maintenance");
test->ssh_maxscale(true, "maxadmin clear server server3 maintenance");
test->stop_maxscale();
test->repl->fix_replication();
test->start_maxscale();
test->tprintf(" Check that MaxScale is running ");
test->tprintf("Check that MaxScale is running ");
test->check_maxscale_alive();
int rval = test->global_result;

View File

@ -1571,7 +1571,7 @@ int Mariadb_nodes::prepare_server(int i)
char str1[1024];
char str2[1024];
ssh_node(i, true, stop_db_command[i]);
ssh_node(i, true, "%s", stop_db_command[i]);
sleep(5);
ssh_node(i, true, "sed -i \"s/bind-address/#bind-address/g\" /etc/mysql/my.cnf.d/*.cnf");
ssh_node(i, true, "ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/usr.sbin.mysqld; sudo service apparmor restart");