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

@ -17,10 +17,10 @@ void add_servers(TestConnections *test)
for (int i = 0; i < 4; i++)
{
test->set_timeout(120);
test->ssh_maxscale(true, "maxadmin add server server%d " MONITOR_NAME, i + 1);
test->ssh_maxscale(true, "maxadmin add server server%d " SERVICE_NAME1, i + 1);
test->ssh_maxscale(true, "maxadmin add server server%d " SERVICE_NAME2, i + 1);
test->ssh_maxscale(true, "maxadmin add server server%d " SERVICE_NAME3, i + 1);
test->maxscales->ssh_node_f(0, true, "maxadmin add server server%d " MONITOR_NAME, i + 1);
test->maxscales->ssh_node_f(0, true, "maxadmin add server server%d " SERVICE_NAME1, i + 1);
test->maxscales->ssh_node_f(0, true, "maxadmin add server server%d " SERVICE_NAME2, i + 1);
test->maxscales->ssh_node_f(0, true, "maxadmin add server server%d " SERVICE_NAME3, i + 1);
test->stop_timeout();
}
}
@ -30,16 +30,16 @@ void do_query(TestConnections *test, bool should_fail)
test->tprintf("Trying to query, expecting %s", should_fail ? "failure" : "success");
test->set_timeout(120);
test->connect_maxscale();
test->maxscales->connect_maxscale(0);
bool failed = execute_query(test->conn_rwsplit, "select @@server_id") == 0;
bool failed = execute_query(test->maxscales->conn_rwsplit[0], "select @@server_id") == 0;
const char *msg = should_fail ?
"Query was successful when failure was expected." :
"Query failed when success was expected.";
test->add_result(failed == should_fail, msg);
test->close_maxscale_connections();
test->maxscales->close_maxscale_connections(0);
test->stop_timeout();
}
@ -52,7 +52,7 @@ int main(int argc, char *argv[])
for (int i = 0; i < 4; i++)
{
test->ssh_maxscale(true, "maxadmin create server server%d %s", i + 1, test->repl->IP[i]);
test->maxscales->ssh_node_f(0, true, "maxadmin create server server%d %s", i + 1, test->repl->IP[i]);
}
/** Add the servers again */
@ -65,13 +65,13 @@ int main(int argc, char *argv[])
test->tprintf("Restarting MaxScale");
test->restart_maxscale();
test->maxscales->restart_maxscale(0);
sleep(2);
do_query(test, false);
test->check_maxscale_alive();
test->check_log_err("Fatal", false);
test->check_maxscale_alive(0);
test->check_log_err(0, "Fatal", false);
int rval = test->global_result;
delete test;
return rval;