refactored tests (#147)
This commit is contained in:
@ -12,13 +12,13 @@ int main(int argc, char *argv[])
|
||||
TestConnections * Test = new TestConnections(argc, argv);
|
||||
|
||||
Test->tprintf("Creating user 'user' with 3 different passwords for different hosts\n");
|
||||
Test->connect_maxscale();
|
||||
execute_query(Test->conn_rwsplit, "CREATE USER 'user'@'non_existing_host1' IDENTIFIED BY 'pass1'");
|
||||
execute_query(Test->conn_rwsplit, "CREATE USER 'user'@'%%' IDENTIFIED BY 'pass2'");
|
||||
execute_query(Test->conn_rwsplit, "CREATE USER 'user'@'non_existing_host2' IDENTIFIED BY 'pass3'");
|
||||
execute_query(Test->conn_rwsplit, "GRANT ALL PRIVILEGES ON *.* TO 'user'@'non_existing_host1'");
|
||||
execute_query(Test->conn_rwsplit, "GRANT ALL PRIVILEGES ON *.* TO 'user'@'%%'");
|
||||
execute_query(Test->conn_rwsplit, "GRANT ALL PRIVILEGES ON *.* TO 'user'@'non_existing_host2'");
|
||||
Test->maxscales->connect_maxscale(0);
|
||||
execute_query(Test->maxscales->conn_rwsplit[0], "CREATE USER 'user'@'non_existing_host1' IDENTIFIED BY 'pass1'");
|
||||
execute_query(Test->maxscales->conn_rwsplit[0], "CREATE USER 'user'@'%%' IDENTIFIED BY 'pass2'");
|
||||
execute_query(Test->maxscales->conn_rwsplit[0], "CREATE USER 'user'@'non_existing_host2' IDENTIFIED BY 'pass3'");
|
||||
execute_query(Test->maxscales->conn_rwsplit[0], "GRANT ALL PRIVILEGES ON *.* TO 'user'@'non_existing_host1'");
|
||||
execute_query(Test->maxscales->conn_rwsplit[0], "GRANT ALL PRIVILEGES ON *.* TO 'user'@'%%'");
|
||||
execute_query(Test->maxscales->conn_rwsplit[0], "GRANT ALL PRIVILEGES ON *.* TO 'user'@'non_existing_host2'");
|
||||
|
||||
Test->tprintf("Synchronizing slaves");
|
||||
Test->set_timeout(50);
|
||||
@ -26,7 +26,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
Test->tprintf("Trying first hostname, expecting failure");
|
||||
Test->set_timeout(15);
|
||||
MYSQL * conn = open_conn(Test->rwsplit_port, Test->maxscale_IP, (char *) "user", (char *) "pass1", Test->ssl);
|
||||
MYSQL * conn = open_conn(Test->maxscales->rwsplit_port[0], Test->maxscales->IP[0], (char *) "user", (char *) "pass1", Test->ssl);
|
||||
if (mysql_errno(conn) == 0)
|
||||
{
|
||||
Test->add_result(1, "MaxScale ignores host in authentication\n");
|
||||
@ -38,7 +38,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
Test->tprintf("Trying second hostname, expecting success");
|
||||
Test->set_timeout(15);
|
||||
conn = open_conn(Test->rwsplit_port, Test->maxscale_IP, (char *) "user", (char *) "pass2", Test->ssl);
|
||||
conn = open_conn(Test->maxscales->rwsplit_port[0], Test->maxscales->IP[0], (char *) "user", (char *) "pass2", Test->ssl);
|
||||
Test->add_result(mysql_errno(conn), "MaxScale can't connect: %s\n", mysql_error(conn));
|
||||
if (conn != NULL)
|
||||
{
|
||||
@ -47,7 +47,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
Test->tprintf("Trying third hostname, expecting failure");
|
||||
Test->set_timeout(15);
|
||||
conn = open_conn(Test->rwsplit_port, Test->maxscale_IP, (char *) "user", (char *) "pass3", Test->ssl);
|
||||
conn = open_conn(Test->maxscales->rwsplit_port[0], Test->maxscales->IP[0], (char *) "user", (char *) "pass3", Test->ssl);
|
||||
if (mysql_errno(conn) == 0)
|
||||
{
|
||||
Test->add_result(1, "MaxScale ignores host in authentication\n");
|
||||
@ -57,10 +57,10 @@ int main(int argc, char *argv[])
|
||||
mysql_close(conn);
|
||||
}
|
||||
|
||||
execute_query(Test->conn_rwsplit, "DROP USER 'user'@'non_existing_host1'");
|
||||
execute_query(Test->conn_rwsplit, "DROP USER 'user'@'%%'");
|
||||
execute_query(Test->conn_rwsplit, "DROP USER 'user'@'non_existing_host2'");
|
||||
Test->close_maxscale_connections();
|
||||
execute_query(Test->maxscales->conn_rwsplit[0], "DROP USER 'user'@'non_existing_host1'");
|
||||
execute_query(Test->maxscales->conn_rwsplit[0], "DROP USER 'user'@'%%'");
|
||||
execute_query(Test->maxscales->conn_rwsplit[0], "DROP USER 'user'@'non_existing_host2'");
|
||||
Test->maxscales->close_maxscale_connections(0);
|
||||
|
||||
int rval = Test->global_result;
|
||||
delete Test;
|
||||
|
Reference in New Issue
Block a user