refactored tests (#147)
This commit is contained in:
@ -19,10 +19,10 @@ int main(int argc, char *argv[])
|
||||
Test->set_timeout(20);
|
||||
Test->repl->connect();
|
||||
|
||||
get_my_ip(Test->maxscale_IP, my_ip);
|
||||
get_my_ip(Test->maxscales->IP[0], my_ip);
|
||||
Test->tprintf("Test machine IP (got via network request) %s\n", my_ip);
|
||||
|
||||
Test->add_result(Test->get_client_ip(my_ip_db), "Unable to get IP using connection to DB\n");
|
||||
Test->add_result(Test->get_client_ip(0, my_ip_db), "Unable to get IP using connection to DB\n");
|
||||
|
||||
Test->tprintf("Test machine IP (got via Show processlist) %s\n", my_ip);
|
||||
|
||||
@ -32,19 +32,20 @@ int main(int argc, char *argv[])
|
||||
Test->tprintf("Test machine IP with %% %s\n", my_ip);
|
||||
|
||||
Test->tprintf("Connecting to Maxscale\n");
|
||||
Test->add_result(Test->connect_maxscale(), "Error connecting to Maxscale\n");
|
||||
Test->add_result(Test->maxscales->connect_maxscale(0), "Error connecting to Maxscale\n");
|
||||
Test->tprintf("Creating user 'user1' for %s host\n", my_ip);
|
||||
Test->set_timeout(30);
|
||||
|
||||
Test->add_result(execute_query(Test->conn_rwsplit, "CREATE USER user1@'%s';", my_ip),
|
||||
Test->add_result(execute_query(Test->maxscales->conn_rwsplit[0], "CREATE USER user1@'%s';", my_ip),
|
||||
"Failed to create user");
|
||||
Test->add_result(execute_query(Test->conn_rwsplit,
|
||||
Test->add_result(execute_query(Test->maxscales->conn_rwsplit[0],
|
||||
"GRANT ALL PRIVILEGES ON *.* TO user1@'%s' identified by 'pass1'; FLUSH PRIVILEGES;", my_ip),
|
||||
"Failed to grant privileges.");
|
||||
|
||||
Test->tprintf("Trying to open connection using user1\n");
|
||||
|
||||
MYSQL * conn = open_conn(Test->rwsplit_port, Test->maxscale_IP, (char *) "user1", (char *) "pass1",
|
||||
MYSQL * conn = open_conn(Test->maxscales->rwsplit_port[0], Test->maxscales->IP[0], (char *) "user1",
|
||||
(char *) "pass1",
|
||||
Test->ssl);
|
||||
if (mysql_errno(conn) != 0)
|
||||
{
|
||||
@ -59,11 +60,12 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
Test->add_result(execute_query(Test->conn_rwsplit, "DROP USER user1@'%s'; FLUSH PRIVILEGES;", my_ip),
|
||||
Test->add_result(execute_query(Test->maxscales->conn_rwsplit[0], "DROP USER user1@'%s'; FLUSH PRIVILEGES;",
|
||||
my_ip),
|
||||
"Query Failed\n");
|
||||
|
||||
Test->close_maxscale_connections();
|
||||
Test->check_maxscale_alive();
|
||||
Test->maxscales->close_maxscale_connections(0);
|
||||
Test->check_maxscale_alive(0);
|
||||
|
||||
int rval = Test->global_result;
|
||||
delete Test;
|
||||
|
||||
Reference in New Issue
Block a user