Reduce excessive sleeping in tests

Some of the tests waited for excessively long periods of time for changes
to propagate. With a one second monitor interval, a sleep of around five
seconds should be plenty enough for all monitor related changes to be
propagated to all systems.
This commit is contained in:
Markus Mäkelä 2017-12-20 10:44:14 +02:00
parent 9962191722
commit b54dca50b5
5 changed files with 17 additions and 86 deletions

View File

@ -212,8 +212,8 @@ int main(int argc, char *argv[])
}
Test->stop_timeout();
Test->tprintf("Sleeping 15 seconds\n");
sleep(15);
Test->tprintf("Sleeping");
sleep(5);
for (i = 0; i < Test->repl->N; i++)
{

View File

@ -35,7 +35,7 @@ int main(int argc, char *argv[])
}
Test->set_timeout(30);
sleep(15);
sleep(5);
Test->set_timeout(30);
Test->tprintf("Connecting to all MaxScale services, expecting error\n");
@ -57,7 +57,6 @@ int main(int argc, char *argv[])
Test->repl->unblock_all_nodes();
Test->stop_timeout();
sleep(15);
Test->check_log_err(0, "fatal signal 11", false);
Test->check_log_err(0, "Failed to create new router session for service", true);

View File

@ -28,81 +28,24 @@ Added a check for server status before routing the query. Now if the server is d
int main(int argc, char *argv[])
{
TestConnections * Test = new TestConnections(argc, argv);
Test->set_timeout(40);
int i;
Test->set_timeout(60);
Test->tprintf("Connecting to Maxscale %s\n", Test->maxscales->IP[0]);
Test->tprintf("Connecting to Maxscale %s", Test->maxscales->IP[0]);
Test->maxscales->connect_maxscale(0);
printf("Setup firewall to block mysql on master\n");
fflush(stdout);
printf("Setup firewall to block mysql on master");
Test->repl->block_node(0);
sleep(1);
Test->tprintf("Trying query to RWSplit, expecting failure, but not a crash\n");
execute_query(Test->maxscales->conn_rwsplit[0], (char *) "show processlist;");
fflush(stdout);
Test->tprintf("Trying query to ReadConn master, expecting failure, but not a crash\n");
execute_query(Test->maxscales->conn_master[0], (char *) "show processlist;");
fflush(stdout);
Test->tprintf("Trying query to ReadConn slave, expecting failure, but not a crash\n");
execute_query(Test->maxscales->conn_slave[0], (char *) "show processlist;");
fflush(stdout);
sleep(1);
Test->tprintf("Trying query to RWSplit, ReadConn master and ReadConn slave: expecting failure, but not a crash");
execute_query(Test->maxscales->conn_rwsplit[0], "show processlist;");
execute_query(Test->maxscales->conn_master[0], "show processlist;");
execute_query(Test->maxscales->conn_slave[0], "show processlist;");
Test->maxscales->close_maxscale_connections(0);
// Wait three monitor intervals to allow the monitor to detect that the server is up
Test->repl->unblock_node(0);
sleep(10);
sleep(3);
Test->maxscales->close_maxscale_connections(0);
Test->tprintf("Checking Maxscale is alive\n");
Test->check_maxscale_alive(0);
Test->set_timeout(20);
Test->tprintf("Connecting to Maxscale %s to check its behaviour in case of blocking all bacxkends\n",
Test->maxscales->IP[0]);
Test->maxscales->connect_maxscale(0);
if (!Test->smoke)
{
for (i = 0; i < Test->repl->N; i++)
{
Test->tprintf("Setup firewall to block mysql on node %d\n", i);
Test->repl->block_node(i);
fflush(stdout);
}
sleep(1);
Test->tprintf("Trying query to RWSplit, expecting failure, but not a crash\n");
execute_query(Test->maxscales->conn_rwsplit[0], (char *) "show processlist;");
fflush(stdout);
Test->tprintf("Trying query to ReadConn master, expecting failure, but not a crash\n");
execute_query(Test->maxscales->conn_master[0], (char *) "show processlist;");
fflush(stdout);
Test->tprintf("Trying query to ReadConn slave, expecting failure, but not a crash\n");
execute_query(Test->maxscales->conn_slave[0], (char *) "show processlist;");
fflush(stdout);
sleep(1);
for (i = 0; i < Test->repl->N; i++)
{
Test->tprintf("Setup firewall back to allow mysql on node %d\n", i);
Test->repl->unblock_node(i);
fflush(stdout);
}
}
Test->stop_timeout();
Test->tprintf("Sleeping 20 seconds\n");
sleep(20);
Test->set_timeout(20);
Test->maxscales->close_maxscale_connections(0);
Test->tprintf("Checking Maxscale is alive\n");
Test->check_maxscale_alive(0);
int rval = Test->global_result;

View File

@ -13,20 +13,13 @@
int main(int argc, char *argv[])
{
TestConnections * Test = new TestConnections(argc, argv);
int i;
Test->tprintf("Connecting to Maxscale %s\n", Test->maxscales->IP[0]);
Test->tprintf("Connecting to Maxscale %s to check its behaviour in case of blocking all backends\n",
Test->maxscales->IP[0]);
Test->maxscales->connect_maxscale(0);
for (i = 0; i < Test->repl->N; i++)
for (int i = 0; i < Test->repl->N; i++)
{
Test->set_timeout(30);
Test->tprintf("Setup firewall to block mysql on node %d\n", i);
Test->repl->block_node(i);
fflush(stdout);
}
Test->set_timeout(200);
@ -36,20 +29,16 @@ int main(int argc, char *argv[])
Test->tprintf("Checking if MaxScale is alive by connecting to MaxAdmin\n");
Test->add_result(Test->maxscales->execute_maxadmin_command(0, (char* ) "show servers"), "Maxadmin execution failed.\n");
for (i = 0; i < Test->repl->N; i++)
for (int i = 0; i < Test->repl->N; i++)
{
Test->set_timeout(30);
Test->tprintf("Setup firewall back to allow mysql on node %d\n", i);
Test->repl->unblock_node(i);
fflush(stdout);
}
Test->stop_timeout();
Test->tprintf("Sleeping 30 seconds\n");
sleep(30);
sleep(3);
Test->set_timeout(30);
Test->tprintf("Checking Maxscale is alive\n");
Test->check_maxscale_alive(0);
int rval = Test->global_result;

View File

@ -26,7 +26,7 @@ int main(int argc, char *argv[])
test.stop_timeout();
test.tprintf("Waiting until the monitor picks a new master");
sleep(20);
sleep(5);
test.set_timeout(30);