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

@ -15,8 +15,8 @@ void add_servers(TestConnections *test)
for (int i = 0; i < 4; i++)
{
test->ssh_maxscale(true, "maxadmin add server server%d " MONITOR_NAME, i + 1);
test->ssh_maxscale(true, "maxadmin add server server%d " SERVICE_NAME, 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_NAME, i + 1);
}
test->stop_timeout();
}
@ -28,8 +28,8 @@ void remove_servers(TestConnections *test)
for (int i = 0; i < 4; i++)
{
test->ssh_maxscale(true, "maxadmin remove server server%d " MONITOR_NAME, i + 1);
test->ssh_maxscale(true, "maxadmin remove server server%d " SERVICE_NAME, i + 1);
test->maxscales->ssh_node_f(0, true, "maxadmin remove server server%d " MONITOR_NAME, i + 1);
test->maxscales->ssh_node_f(0, true, "maxadmin remove server server%d " SERVICE_NAME, i + 1);
}
test->stop_timeout();
}
@ -41,7 +41,7 @@ void destroy_servers(TestConnections *test)
for (int i = 0; i < 4; i++)
{
test->ssh_maxscale(true, "maxadmin destroy server server%d", i + 1);
test->maxscales->ssh_node_f(0, true, "maxadmin destroy server server%d", i + 1);
}
test->stop_timeout();
}
@ -51,16 +51,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();
}
@ -73,8 +73,8 @@ int main(int argc, char *argv[])
for (int i = 0; i < 4; i++)
{
test->ssh_maxscale(true, "maxadmin create server server%d 3306 %s",
i + 1, test->repl->IP[i]);
test->maxscales->ssh_node_f(0, true, "maxadmin create server server%d 3306 %s",
i + 1, test->repl->IP[i]);
}
/** Add the servers to the monitor and service */
@ -89,7 +89,8 @@ int main(int argc, char *argv[])
test->tprintf("Create the servers with correct parameters");
for (int i = 0; i < 4; i++)
{
test->ssh_maxscale(true, "maxadmin create server server%d %s %d", i + 1, test->repl->IP[i], test->repl->port[i]);
test->maxscales->ssh_node_f(0, true, "maxadmin create server server%d %s %d", i + 1, test->repl->IP[i],
test->repl->port[i]);
}
/** Add the servers again */
@ -106,7 +107,7 @@ int main(int argc, char *argv[])
do_query(test, true);
test->check_maxscale_processes(1);
test->check_maxscale_processes(0, 1);
int rval = test->global_result;
delete test;
return rval;