refactored tests (#147)

This commit is contained in:
Timofey Turenko
2017-12-08 12:23:04 +02:00
committed by GitHub
parent c6daf8c26b
commit 3c88bf1ec6
253 changed files with 5265 additions and 3649 deletions

View File

@ -13,25 +13,25 @@ void check_master(TestConnections& test)
{
test.add_result(test.find_master_maxadmin(test.repl) != 0, "Node 0 is not the master");
test.connect_maxscale();
test.try_query(test.conn_rwsplit, "INSERT INTO test.t1 VALUES (1)");
test.close_maxscale_connections();
test.maxscales->connect_maxscale(0);
test.try_query(test.maxscales->conn_rwsplit[0], "INSERT INTO test.t1 VALUES (1)");
test.maxscales->close_maxscale_connections(0);
}
void check_slave(TestConnections& test)
{
test.add_result(test.find_slave_maxadmin(test.repl) == -1, "No slaves found");
test.connect_maxscale();
test.try_query(test.conn_rwsplit, "SELECT * FROM test.t1");
test.close_maxscale_connections();
test.maxscales->connect_maxscale(0);
test.try_query(test.maxscales->conn_rwsplit[0], "SELECT * FROM test.t1");
test.maxscales->close_maxscale_connections(0);
}
void kill_maxscale(TestConnections& test)
{
test.tprintf("Killing and restarting MaxScale");
test.ssh_maxscale(true, "pkill -9 maxscale");
test.start_maxscale();
test.maxscales->ssh_node_f(0, true, "pkill -9 maxscale");
test.maxscales->start_maxscale(0);
test.tprintf("Waiting for MaxScale to start");
sleep(10);
@ -39,7 +39,7 @@ void kill_maxscale(TestConnections& test)
void restart_maxscale(TestConnections& test)
{
test.restart_maxscale();
test.maxscales->restart_maxscale(0);
test.tprintf("Waiting for MaxScale to start");
sleep(10);
}
@ -48,9 +48,9 @@ int main(int argc, char** argv)
{
TestConnections test(argc, argv);
test.connect_maxscale();
test.try_query(test.conn_rwsplit, "CREATE OR REPLACE TABLE test.t1(id int)");
test.close_maxscale_connections();
test.maxscales->connect_maxscale(0);
test.try_query(test.maxscales->conn_rwsplit[0], "CREATE OR REPLACE TABLE test.t1(id int)");
test.maxscales->close_maxscale_connections(0);
test.tprintf("Checking that node 0 is the master and slaves are OK");
check_master(test);