refactored tests (#147)
This commit is contained in:
@ -4,7 +4,7 @@
|
||||
* - create 'user' with password 'pass2'
|
||||
* - create load on Master (3 threads are inserting data into 't1' in the loop)
|
||||
* - in 40 parallel threads open connection, execute change_user to 'user', execute change_user to default user, close connection
|
||||
* - repeat test first only for RWSplit and second for all routers
|
||||
* - repeat test first only for RWSplit and second for all maxscales->routers[0]
|
||||
* - check logs for lack of "Unable to write to backend 'server2' due to authentication failure" errors
|
||||
* - check for lack of crashes in the log
|
||||
*/
|
||||
@ -31,8 +31,8 @@ void *query_thread_master(void *ptr);
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
TestConnections * Test = new TestConnections(argc, argv);
|
||||
Test->ssh_maxscale(true, "sysctl net.ipv4.tcp_tw_reuse=1 net.ipv4.tcp_tw_recycle=1 "
|
||||
"net.core.somaxconn=10000 net.ipv4.tcp_max_syn_backlog=10000");
|
||||
Test->maxscales->ssh_node_f(0, true, "sysctl net.ipv4.tcp_tw_reuse=1 net.ipv4.tcp_tw_recycle=1 "
|
||||
"net.core.somaxconn=10000 net.ipv4.tcp_max_syn_backlog=10000");
|
||||
Test->set_timeout(20);
|
||||
|
||||
int threads_num = 40;
|
||||
@ -82,17 +82,17 @@ int main(int argc, char *argv[])
|
||||
int iret_master[master_load_threads_num];
|
||||
|
||||
Test->repl->connect();
|
||||
Test->connect_maxscale();
|
||||
create_t1(Test->conn_rwsplit);
|
||||
Test->maxscales->connect_maxscale(0);
|
||||
create_t1(Test->maxscales->conn_rwsplit[0]);
|
||||
Test->repl->execute_query_all_nodes((char *) "set global max_connections = 2000;");
|
||||
Test->repl->sync_slaves();
|
||||
|
||||
Test->tprintf("Creating user 'user' \n");
|
||||
execute_query(Test->conn_rwsplit, (char *) "DROP USER user@'%%'");
|
||||
execute_query(Test->conn_rwsplit, (char *) "CREATE USER user@'%%' IDENTIFIED BY 'pass2'");
|
||||
execute_query(Test->conn_rwsplit, (char *) "GRANT SELECT ON test.* TO user@'%%'");
|
||||
execute_query(Test->conn_rwsplit, (char *) "DROP TABLE IF EXISTS test.t1");
|
||||
execute_query(Test->conn_rwsplit, (char *) "CREATE TABLE test.t1 (x1 int, fl int)");
|
||||
execute_query(Test->maxscales->conn_rwsplit[0], (char *) "DROP USER user@'%%'");
|
||||
execute_query(Test->maxscales->conn_rwsplit[0], (char *) "CREATE USER user@'%%' IDENTIFIED BY 'pass2'");
|
||||
execute_query(Test->maxscales->conn_rwsplit[0], (char *) "GRANT SELECT ON test.* TO user@'%%'");
|
||||
execute_query(Test->maxscales->conn_rwsplit[0], (char *) "DROP TABLE IF EXISTS test.t1");
|
||||
execute_query(Test->maxscales->conn_rwsplit[0], (char *) "CREATE TABLE test.t1 (x1 int, fl int)");
|
||||
Test->repl->sync_slaves();
|
||||
|
||||
/* Create independent threads each of them will create some load on Master */
|
||||
@ -119,7 +119,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
Test->repl->flush_hosts();
|
||||
|
||||
Test->tprintf("all routers are involved, threads are running %d seconds more\n", run_time);
|
||||
Test->tprintf("all maxscales->routers[0] are involved, threads are running %d seconds more\n", run_time);
|
||||
Test->set_timeout(run_time + 100);
|
||||
|
||||
for (i = 0; i < threads_num; i++)
|
||||
@ -151,21 +151,21 @@ int main(int argc, char *argv[])
|
||||
|
||||
Test->tprintf("Dropping tables and users\n");
|
||||
Test->set_timeout(60);
|
||||
execute_query(Test->conn_rwsplit, (char *) "DROP TABLE test.t1;");
|
||||
execute_query(Test->conn_rwsplit, (char *) "DROP USER user@'%%'");
|
||||
Test->close_maxscale_connections();
|
||||
execute_query(Test->maxscales->conn_rwsplit[0], (char *) "DROP TABLE test.t1;");
|
||||
execute_query(Test->maxscales->conn_rwsplit[0], (char *) "DROP USER user@'%%'");
|
||||
Test->maxscales->close_maxscale_connections(0);
|
||||
|
||||
Test->set_timeout(160);
|
||||
Test->tprintf("Trying to connect Maxscale\n");
|
||||
Test->connect_maxscale();
|
||||
Test->maxscales->connect_maxscale(0);
|
||||
Test->tprintf("Closing Maxscale connections\n");
|
||||
Test->close_maxscale_connections();
|
||||
Test->maxscales->close_maxscale_connections(0);
|
||||
Test->tprintf("Checking if Maxscale alive\n");
|
||||
Test->check_maxscale_alive();
|
||||
Test->check_maxscale_alive(0);
|
||||
Test->tprintf("Checking log for unwanted errors\n");
|
||||
Test->check_log_err((char *) "due to authentication failure", false);
|
||||
Test->check_log_err((char *) "fatal signal 11", false);
|
||||
Test->check_log_err((char *) "due to handshake failure", false);
|
||||
Test->check_log_err(0, (char *) "due to authentication failure", false);
|
||||
Test->check_log_err(0, (char *) "fatal signal 11", false);
|
||||
Test->check_log_err(0, (char *) "due to handshake failure", false);
|
||||
|
||||
// We need to wait for the TCP connections in TIME_WAIT state so that
|
||||
// later tests don't fail due to a lack of file descriptors
|
||||
@ -183,7 +183,7 @@ void *query_thread1(void *ptr)
|
||||
|
||||
while (data->exit_flag == 0)
|
||||
{
|
||||
data->conn1 = data->Test->open_rwsplit_connection();
|
||||
data->conn1 = data->Test->maxscales->open_rwsplit_connection(0);
|
||||
|
||||
if (data->conn1 != NULL)
|
||||
{
|
||||
@ -195,7 +195,7 @@ void *query_thread1(void *ptr)
|
||||
}
|
||||
if (data->rwsplit_only == 0)
|
||||
{
|
||||
data->conn2 = data->Test->open_readconn_master_connection();
|
||||
data->conn2 = data->Test->maxscales->open_readconn_master_connection(0);
|
||||
|
||||
if (data->conn2 != NULL)
|
||||
{
|
||||
@ -206,7 +206,7 @@ void *query_thread1(void *ptr)
|
||||
}
|
||||
}
|
||||
|
||||
data->conn3 = data->Test->open_readconn_slave_connection();
|
||||
data->conn3 = data->Test->maxscales->open_readconn_slave_connection(0);
|
||||
|
||||
if (data->conn3 != NULL)
|
||||
{
|
||||
|
Reference in New Issue
Block a user