refactored tests (#147)
This commit is contained in:
@ -7,14 +7,14 @@
|
||||
|
||||
bool try_connect(TestConnections& test)
|
||||
{
|
||||
const char* ip = test.maxscale_IP;
|
||||
const char* user = test.maxscale_user;
|
||||
const char* pw = test.maxscale_password;
|
||||
const char* ip = test.maxscales->IP[0];
|
||||
const char* user = test.maxscales->user_name;
|
||||
const char* pw = test.maxscales->password;
|
||||
const char* db = "test_db";
|
||||
|
||||
MYSQL* rwsplit = open_conn_db(test.rwsplit_port, ip, db, user, pw, false);
|
||||
MYSQL* master = open_conn_db(test.readconn_master_port, ip, db, user, pw, false);
|
||||
MYSQL* slave = open_conn_db(test.readconn_slave_port, ip, db, user, pw, false);
|
||||
MYSQL* rwsplit = open_conn_db(test.maxscales->rwsplit_port[0], ip, db, user, pw, false);
|
||||
MYSQL* master = open_conn_db(test.maxscales->readconn_master_port[0], ip, db, user, pw, false);
|
||||
MYSQL* slave = open_conn_db(test.maxscales->readconn_slave_port[0], ip, db, user, pw, false);
|
||||
bool rval = false;
|
||||
|
||||
if (rwsplit && master && slave &&
|
||||
@ -40,8 +40,9 @@ int main(int argc, char *argv[])
|
||||
test.tprintf("Connecting to RWSplit");
|
||||
|
||||
test.set_timeout(30);
|
||||
MYSQL* conn = open_conn_no_db(test.rwsplit_port, test.maxscale_IP, test.maxscale_user,
|
||||
test.maxscale_password, test.ssl);
|
||||
MYSQL* conn = open_conn_no_db(test.maxscales->rwsplit_port[0], test.maxscales->IP[0],
|
||||
test.maxscales->user_name,
|
||||
test.maxscales->password, test.ssl);
|
||||
test.add_result(conn == NULL, "Error connecting to MaxScale");
|
||||
|
||||
test.tprintf("Removing 'test_db' DB");
|
||||
@ -52,12 +53,12 @@ int main(int argc, char *argv[])
|
||||
sleep(5);
|
||||
|
||||
test.set_timeout(30);
|
||||
test.tprintf("Connection to non-existing DB (all routers)");
|
||||
test.tprintf("Connection to non-existing DB (all maxscales->routers[0])");
|
||||
test.add_result(try_connect(test), "Connection with dropped database should fail");
|
||||
|
||||
test.tprintf("Connecting to RWSplit again to recreate 'test_db' db");
|
||||
conn = open_conn_no_db(test.rwsplit_port, test.maxscale_IP, test.maxscale_user,
|
||||
test.maxscale_password, test.ssl);
|
||||
conn = open_conn_no_db(test.maxscales->rwsplit_port[0], test.maxscales->IP[0], test.maxscales->user_name,
|
||||
test.maxscales->password, test.ssl);
|
||||
test.add_result(conn == NULL, "Error connecting to MaxScale");
|
||||
|
||||
test.tprintf("Creating and selecting 'test_db' DB");
|
||||
@ -72,8 +73,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
|
||||
test.tprintf("Trying simple operations with t1 ");
|
||||
conn = open_conn_no_db(test.rwsplit_port, test.maxscale_IP, test.maxscale_user,
|
||||
test.maxscale_password, test.ssl);
|
||||
conn = open_conn_no_db(test.maxscales->rwsplit_port[0], test.maxscales->IP[0], test.maxscales->user_name,
|
||||
test.maxscales->password, test.ssl);
|
||||
test.try_query(conn, "USE test_db");
|
||||
test.try_query(conn, "INSERT INTO t1 (x1, fl) VALUES(0, 1)");
|
||||
test.set_timeout(60);
|
||||
|
||||
Reference in New Issue
Block a user