Files
MaxScale/maxscale-system-test/mxs1509.cpp
Timofey Turenko e1fc0b8734 Squashed commit of the following:
commit 48a0b902b67da46f1eed4afa687bdcb56b59d02f
Author: Timofey Turenko <timofey.turenko@mariadb.com>
Date:   Mon Dec 16 15:35:07 2019 +0200

    Increase timouts in the mxs173_trottle_filter test

commit 81d8083a89421a8004b8024d480ae0f35d715b86
Author: Timofey Turenko <timofey.turenko@mariadb.com>
Date:   Mon Dec 16 14:19:39 2019 +0200

    Increase timeouts in max1071_maxrow test

commit e1039c6132f0e9274b8801165f3f905ede7c9421
Author: Timofey Turenko <timofey.turenko@mariadb.com>
Date:   Mon Dec 16 00:06:53 2019 +0200

    Remove hardcoded 'home/vagrant/' from all maxscale.cnf in system tests

commit 28c8029e060afdcf5159bf802b13dcd5e484d9f1
Author: Timofey Turenko <timofey.turenko@mariadb.com>
Date:   Sun Dec 15 21:31:34 2019 +0200

    Use private IP for Galera congiguration in maxscale-system-tests

commit 66dc36cbf43a5fb92465df31e1295e82865be1fc
Author: Timofey Turenko <timofey.turenko@mariadb.com>
Date:   Sun Dec 15 09:06:28 2019 +0200

    Fix typos in fwf_*.cpp

commit 44c7a4384ddf39596c0254c955aeb6c008a00a35
Author: Timofey Turenko <timofey.turenko@mariadb.com>
Date:   Sun Dec 15 09:05:26 2019 +0200

    Fix typos in fwf_*.cpp

commit 2649017611908a8b0d27090f49722947ac31c4f4
Author: Timofey Turenko <timofey.turenko@mariadb.com>
Date:   Sun Dec 15 09:03:41 2019 +0200

    Fix typos in fwf_*.cpp

commit 5cc87658523e8496eaab17700be8a821af5b0cde
Author: Timofey Turenko <timofey.turenko@mariadb.com>
Date:   Sat Dec 14 23:54:53 2019 +0200

    Fix typo in fwf_copy_rules.cpp

commit fb1accc36cb9d79691469f63cb4535f3bc38dedd
Author: Timofey Turenko <timofey.turenko@mariadb.com>
Date:   Sat Dec 14 23:52:51 2019 +0200

    More hardcoded 'vagrant' removals

commit 77e49d474b4abe767629ff87b01f08137773d761
Author: Timofey Turenko <timofey.turenko@mariadb.com>
Date:   Sat Dec 14 23:35:09 2019 +0200

    Fix hardcoded 'vagrant' user in fwf* tests

    Several firewall filter tests has hardcoded 'vagrant' as a user name for
    access user on the VM. Changed to node->access_user.

commit ed5ab1487f37822db6a7478f76c0f3652776c389
Author: Timofey Turenko <timofey.turenko@mariadb.com>
Date:   Sat Dec 14 22:50:35 2019 +0200

    Fix IP vs IP_private

    Many tests use IP instead of IP_private which makes them failed in the
    AWS or GCloud environment.
    The same applies to get_conn_num() etc functions.

commit 0558aac23d303a675dc12d05b1766e698753b444
Author: Timofey Turenko <timofey.turenko@mariadb.com>
Date:   Thu Aug 15 12:02:01 2019 +0300

    fix IP -> IP_private for some mysqlmon* testst

commit 5d9c70970d970eb995c8774d0088bd1c54ab76fe
Author: Timofey Turenko <timofey.turenko@mariadb.com>
Date:   Sat Dec 14 20:20:51 2019 +0200

    Replace IP to IP_private in the maxscale-system-tests

commit b06cf3329af59ff100748691991213fe639f29e6
Author: Timofey Turenko <timofey.turenko@mariadb.com>
Date:   Tue Nov 19 11:52:33 2019 +0200

    Remove spaces from value which were read from *_network_config

    MDBCI can put spaces around values in the *_network_config file which
    can cause ssh connection failures in the tests. To fix it removing all
    spaces from all values which were read from *_network_config

commit b3904f019847ef1db9d4ec9714ad9ef869fa0b01
Author: Timofey Turenko <timofey.turenko@mariadb.com>
Date:   Thu Dec 12 23:36:31 2019 +0200

    Increate default timeout for all system tests
2019-12-16 15:41:52 +02:00

87 lines
3.3 KiB
C++

/**
* MXS-1509: Show correct server state for multisource replication
*
* https://jira.mariadb.org/browse/MXS-1509
*/
#include "testconnections.h"
#include <sstream>
void change_master(TestConnections& test, int slave, int master, const char* name = NULL)
{
std::string source;
if (name)
{
source = "'";
source += name;
source += "'";
}
execute_query(test.repl->nodes[slave],
"STOP ALL SLAVES;"
"SET GLOBAL gtid_slave_pos='0-1-0';"
"CHANGE MASTER %s TO master_host='%s', master_port=3306, master_user='%s', master_password='%s', master_use_gtid=slave_pos;"
"START ALL SLAVES",
source.c_str(),
test.repl->IP_private[master],
test.repl->user_name,
test.repl->password);
}
void check_status(TestConnections& test, const StringSet& expected_master, const StringSet& expected_slave)
{
sleep(2);
StringSet master = test.get_server_status("server1");
StringSet slave = test.get_server_status("server2");
test.add_result(master != expected_master,
"Master status is not what was expected: %s",
dump_status(master, expected_master).c_str());
test.add_result(slave != expected_slave,
"Slave status is not what was expected: %s",
dump_status(slave, expected_slave).c_str());
}
int main(int argc, char** argv)
{
TestConnections test(argc, argv);
test.repl->connect();
test.tprintf("Server sanity check");
check_status(test, {"Master", "Running"}, {"Slave", "Running"});
test.tprintf("Stop replication on nodes three and four");
execute_query(test.repl->nodes[2], "STOP ALL SLAVES; RESET SLAVE ALL;");
execute_query(test.repl->nodes[3], "STOP ALL SLAVES; RESET SLAVE ALL;");
test.tprintf("Point the master to an external server");
change_master(test, 1, 0);
change_master(test, 0, 2);
check_status(test, {"Master", "Running"}, {"Slave", "Running"});
test.tprintf("Resetting the slave on master should have no effect");
execute_query(test.repl->nodes[0], "STOP ALL SLAVES; RESET SLAVE ALL;");
check_status(test, {"Master", "Running"}, {"Slave", "Running"});
// TODO: Fix this so that multi-source replication is tested
// test.tprintf("Configure multi-source replication, check that master status is as expected");
// change_master(test, 0, 2, "extra-slave");
// change_master(test, 1, 2, "extra-slave");
// check_status(test, {"Master", "Running"}, {"Slave", "Running", "Slave of External Server"});
// test.tprintf("Stopping multi-source replication on slave should remove the Slave of External Server
// status");
// execute_query(test.repl->nodes[1], "STOP SLAVE 'extra-slave'; RESET SLAVE 'extra-slave';");
// check_status(test, {"Master", "Running"}, {"Slave", "Running"});
// sleep(60);
// test.tprintf("Doing the same on the master should have no effect");
// execute_query(test.repl->nodes[0], "STOP ALL SLAVES; RESET SLAVE ALL;");
// check_status(test, {"Master", "Running"}, {"Slave", "Running"});
test.tprintf("Cleanup");
test.repl->execute_query_all_nodes("STOP ALL SLAVES; RESET SLAVE ALL;");
test.repl->fix_replication();
return test.global_result;
}