Remove unnecessary sleeps from tests

Removed unnecessary sleeps and replaced sleeps with wait_for_monitor in
some older tests. Also removed the odd arrangement of arrays in
server_weight.
This commit is contained in:
Markus Mäkelä 2018-11-18 22:39:41 +02:00
parent 47092ed18a
commit fd3a42ceb6
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19
4 changed files with 10 additions and 20 deletions

View File

@ -59,8 +59,6 @@ int main(int argc, char* argv[])
Test->tprintf("Trying 26 connections with Readconnn slave\n");
check_max_conn(2, 25, Test);
sleep(10);
Test->check_maxscale_alive(0);
int rval = Test->global_result;
delete Test;

View File

@ -32,7 +32,7 @@ int main(int argc, char* argv[])
Test->repl->unblock_node(0);
Test->stop_timeout();
sleep(10);
Test->maxscales->wait_for_monitor();
Test->set_timeout(30);
Test->tprintf("Reconnecting and trying query to RWSplit\n");

View File

@ -30,7 +30,7 @@ int main(int argc, char* argv[])
{
int maxscale_conn_num = 60;
MYSQL* conn_read[maxscale_conn_num];
MYSQL* conn_rwsplit[0][maxscale_conn_num];
MYSQL* conn_rwsplit[maxscale_conn_num];
TestConnections test(argc, argv);
test.set_timeout(30);
int i;
@ -40,13 +40,12 @@ int main(int argc, char* argv[])
test.tprintf("Connecting to ReadConnMaster on %s\n", test.maxscales->IP[0]);
for (i = 0; i < maxscale_conn_num; i++)
{
// Open the connection and perform a query on it. This way we know it'll
// be fully established when we count the connections.
conn_read[i] = test.maxscales->open_readconn_master_connection(0);
test.try_query(conn_read[i], "SELECT 1");
}
test.stop_timeout();
test.tprintf("Sleeping 15 seconds\n");
sleep(15);
int Nc[4];
Nc[0] = maxscale_conn_num / 6;
@ -62,21 +61,14 @@ int main(int argc, char* argv[])
mysql_close(conn_read[i]);
}
test.stop_timeout();
test.tprintf("Sleeping 15 seconds\n");
sleep(15);
test.set_timeout(30);
test.tprintf("Connecting to RWSplit on %s\n", test.maxscales->IP[0]);
for (i = 0; i < maxscale_conn_num; i++)
{
conn_rwsplit[0][i] = test.maxscales->open_rwsplit_connection(0);
conn_rwsplit[i] = test.maxscales->open_rwsplit_connection(0);
test.try_query(conn_rwsplit[i], "SELECT 1");
}
test.stop_timeout();
test.tprintf("Sleeping 15 seconds\n");
sleep(15);
Nc[1] = maxscale_conn_num / 2;
Nc[2] = maxscale_conn_num / 3;
Nc[3] = maxscale_conn_num / 6;
@ -88,7 +80,7 @@ int main(int argc, char* argv[])
for (i = 0; i < maxscale_conn_num; i++)
{
mysql_close(conn_rwsplit[0][i]);
mysql_close(conn_rwsplit[i]);
}
test.repl->close_connections();

View File

@ -21,7 +21,7 @@ int main(int argc, char* argv[])
printf("Connecting to RWSplit");
test.set_timeout(60);
test.add_result(test.maxscales->connect_rwsplit(0), "Error connection to RWSplit! Exiting");
sleep(5);
test.maxscales->wait_for_monitor();
test.tprintf("Checking current slave");
int res = 0;
@ -35,7 +35,7 @@ int main(int argc, char* argv[])
test.tprintf("Waiting for MaxScale to find a new slave");
test.stop_timeout();
sleep(10);
test.maxscales->wait_for_monitor();
test.set_timeout(20);
int current_slave = test.find_connected_slave(0, &res);