From d63af9df0bb09a3fd6dd78f5402d8f33dace2866 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Fri, 2 Jun 2017 22:30:44 +0300 Subject: [PATCH] Fix 2.2 test results The changes to object naming and tee filter rewriting caused a number of changes in the expected outcome of tests and how the tests have to behave. --- maxscale-system-test/CMakeLists.txt | 2 +- maxscale-system-test/bug645_1.cpp | 102 +----- maxscale-system-test/bug650.cpp | 79 +---- maxscale-system-test/bug664.cpp | 315 +----------------- maxscale-system-test/bug673.cpp | 26 +- maxscale-system-test/fwf_reload.cpp | 2 +- .../mxs874_slave_recovery.cpp | 60 ++-- 7 files changed, 66 insertions(+), 520 deletions(-) diff --git a/maxscale-system-test/CMakeLists.txt b/maxscale-system-test/CMakeLists.txt index dd5c8a2bf..5c343efeb 100644 --- a/maxscale-system-test/CMakeLists.txt +++ b/maxscale-system-test/CMakeLists.txt @@ -591,7 +591,7 @@ add_test_script(ssl sql_queries ssl LABELS maxscale readwritesplit REPL_BACKEND) #add_test_script(ssl_load load_balancing ssl_load LABELS maxscale readwritesplit REPL_BACKEND) # Check load balancing, client ssl is ON, Galera backend -add_test_script(ssl_load_galera load_balancing_galera ssl_load_galera LABELS maxscale readwritesplit GALERA_BACKEND) +#add_test_script(ssl_load_galera load_balancing_galera ssl_load_galera LABELS maxscale readwritesplit GALERA_BACKEND) # Testing slaves who have lost their master and how MaxScale works with them add_test_executable(stale_slaves.cpp stale_slaves replication LABELS mysqlmon REPL_BACKEND) diff --git a/maxscale-system-test/bug645_1.cpp b/maxscale-system-test/bug645_1.cpp index b2d15f37a..b5a1b6068 100644 --- a/maxscale-system-test/bug645_1.cpp +++ b/maxscale-system-test/bug645_1.cpp @@ -1,103 +1,17 @@ /** * @file bug643.cpp regression case for bugs 645 ("Tee filter with readwritesplit service hangs MaxScale") - * - setup RWSplit in the following way - * @verbatim -[RW_Router] -type=service -router=readconnroute -servers=server1 -user=skysql -passwd=skysql -version_string=5.1-OLD-Bored-Mysql -filters=DuplicaFilter - -[RW_Split] -type=service -router=readwritesplit -servers=server3,server2 -user=skysql -passwd=skysql - -[DuplicaFilter] -type=filter -module=tee -service=RW_Split - -[RW_Listener] -type=listener -service=RW_Router -protocol=MySQLClient -port=4006 - -[RW_Split_list] -type=listener -service=RW_Split -protocol=MySQLClient -port=4016 - -[Read Connection Router Slave] -type=service -router=readconnroute -router_options= slave -servers=server1,server2,server3,server4 -user=skysql -passwd=skysql -filters=QLA - -[Read Connection Router Master] -type=service -router=readconnroute -router_options=master -servers=server1,server2,server3,server4 -user=skysql -passwd=skysql -filters=QLA - -[Read Connection Listener Slave] -type=listener -service=Read Connection Router Slave -protocol=MySQLClient -port=4009 - -[Read Connection Listener Master] -type=listener -service=Read Connection Router Master -protocol=MySQLClient -port=4008 - - - @endverbatim - * - try to connect to all services except 4016 - * - try simple query - * - check ReadConn is ok - * - check log for presens of "Couldn't find suitable Master from 2 candidates" errors + * + * - Try to connect to all services except 4016 + * - Try simple query on all services + * - Check log for presence of "Couldn't find suitable Master from 2 candidates" errors */ - -#include #include "testconnections.h" int main(int argc, char *argv[]) { - TestConnections * Test = new TestConnections(argc, argv); - Test->set_timeout(10); - - Test->connect_maxscale(); - Test->tprintf("trying query to RWSplit, expecting failure\n"); - if (execute_query(Test->conn_rwsplit, (char *) "show processlist") == 0) - { - Test->add_result(1, "Query is ok, but failue is expected\n"); - } - Test->tprintf("Trying query to ReadConn router master\n"); - Test->try_query(Test->conn_master, (char *) "show processlist"); - Test->tprintf("Trying query to ReadConn router slave\n"); - Test->try_query(Test->conn_slave, (char *) "show processlist"); - - Test->close_maxscale_connections(); - - Test->check_log_err((char *) "Couldn't find suitable Master from 2 candidates", true); - - int rval = Test->global_result; - delete Test; - return rval; + TestConnections test(argc, argv); + test.check_maxscale_alive(); + test.check_log_err( "Couldn't find suitable Master from 2 candidates", true); + return test.global_result; } diff --git a/maxscale-system-test/bug650.cpp b/maxscale-system-test/bug650.cpp index c981a90d4..d7cfce143 100644 --- a/maxscale-system-test/bug650.cpp +++ b/maxscale-system-test/bug650.cpp @@ -1,81 +1,16 @@ /** * @file bug650.cpp regression case for bug 650 ("Hints, RWSplit: MaxScale goes into infinite loop and crashes") and bug645 - * - setup RWSplit in the following way - * @verbatim -[RW_Router] -type=service -router=readconnroute -servers=server1 -user=skysql -passwd=skysql -version_string=5.1-OLD-Bored-Mysql -filters=DuplicaFilter - -[RW_Split] -type=service -router=readwritesplit -servers=server3,server2 -user=skysql -passwd=skysql - -[DuplicaFilter] -type=filter -module=tee -service=RW_Split - -[RW_Listener] -type=listener -service=RW_Router -protocol=MySQLClient -port=4006 - -[RW_Split_list] -type=listener -service=RW_Split -protocol=MySQLClient -port=4016 - - @endverbatim - * - try to connect - * - try simple query using ReadConn router (both, master and slave) - * - check errors in the log - @verbatim - Couldn't find suitable Master from 2 candidates - Failed to create RW_Split session. - Creating client session for Tee filter failed. Terminating session. - Failed to create filter 'DuplicaFilter' for service 'RW_Router' - Setting up filters failed. Terminating session RW_Router - @endverbatim + * - try simple query using all services + * - check for errors in the log */ - -#include #include "testconnections.h" int main(int argc, char *argv[]) { - TestConnections * Test = new TestConnections(argc, argv); - Test->set_timeout(20); - - Test->connect_maxscale(); - Test->tprintf("Trying query to ReadConn master\n"); - Test->try_query(Test->conn_master, (char *) "show processlist"); - Test->tprintf("Trying query to ReadConn slave\n"); - Test->try_query(Test->conn_slave, (char *) "show processlist"); - Test->tprintf("Trying query to RWSplit, expecting failure\n"); - if (execute_query(Test->conn_rwsplit, (char *) "show processlist") == 0) - { - Test->add_result(1, "Query is ok, but failure is expected\n"); - } - Test->close_maxscale_connections(); - - Test->tprintf("Checking logs\n"); - - Test->check_log_err((char *) "Couldn't find suitable Master from 2 candidates", true); - Test->check_log_err((char *) "Failed to create new router session for service 'RW_Split'", true); - - int rval = Test->global_result; - delete Test; - return rval; + TestConnections test(argc, argv); + test.check_maxscale_alive(); + test.check_log_err( "Couldn't find suitable Master from 2 candidates", true); + test.check_log_err( "Failed to create new router session for service 'RW_Split'", true); + return test.global_result; } - diff --git a/maxscale-system-test/bug664.cpp b/maxscale-system-test/bug664.cpp index ef7c22801..f1937ca0d 100644 --- a/maxscale-system-test/bug664.cpp +++ b/maxscale-system-test/bug664.cpp @@ -1,316 +1,17 @@ /** - * @file bug664.cpp bug664 regression case ("Core: Access of freed memory in gw_send_authentication_to_backend") + * @file bug664.cpp Tee filter branch session failure test * - * - Maxscale.cnf contains: - * @verbatim -[RW_Router] -type=service -router=readconnroute -servers=server1 -user=maxuser -passwd=maxpwd -version_string=5.1-OLD-Bored-Mysql -filters=DuplicaFilter - -[RW_Split] -type=service -router=readwritesplit -servers=server3,server2 -user=maxuser -passwd=maxpwd - -[DuplicaFilter] -type=filter -module=tee -service=RW_Split - -[RW_Listener] -type=listener -service=RW_Router -protocol=MySQLClient -port=4006 - -[RW_Split_list] -type=listener -service=RW_Split -protocol=MySQLClient -port=4016 - -[Read Connection Router Slave] -type=service -router=readconnroute -router_options= slave -servers=server1,server2,server3,server4 -user=maxuser -passwd=maxpwd -filters=QLA - -[Read Connection Router Master] -type=service -router=readconnroute -router_options=master -servers=server1,server2,server3,server4 -user=maxuser -passwd=maxpwd -filters=QLA - -[Read Connection Listener Slave] -type=listener -service=Read Connection Router Slave -protocol=MySQLClient -port=4009 - -[Read Connection Listener Master] -type=listener -service=Read Connection Router Master -protocol=MySQLClient -port=4008 - - @endverbatim - * - warning is expected in the log, but not an error. All Maxscale services should be alive. - * - Check MaxScale is alive + * - Configure MaxScale so that the branched session will always fail + * - Execute query on the main service and check that MaxScale is alive + * - An error should be logged about the failed branch session */ -/* -Vilho Raatikka 2014-12-29 18:12:23 UTC -All these cases are due to accessing freed dcb->data (MYSQL_session *): - -==12419== Invalid read of size 1 -==12419== at 0x1B1434BA: gw_send_authentication_to_backend (mysql_common.c:544) -==12419== by 0x1B13F90E: gw_read_backend_event (mysql_backend.c:228) -==12419== by 0x588CA2: process_pollq (poll.c:858) -==12419== by 0x58854B: poll_waitevents (poll.c:608) -==12419== by 0x57C11B: main (gateway.c:1792) -==12419== Address 0x18690285 is 149 bytes inside a block of size 278 free'd -==12419== at 0x4C2AF6C: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) -==12419== by 0x57D806: dcb_final_free (dcb.c:406) -==12419== by 0x57DDE6: dcb_process_zombies (dcb.c:603) -==12419== by 0x588598: poll_waitevents (poll.c:613) -==12419== by 0x57C11B: main (gateway.c:1792) -==12419== -==12419== Invalid read of size 1 -==12419== at 0x1B1434D6: gw_send_authentication_to_backend (mysql_common.c:547) -==12419== by 0x1B13F90E: gw_read_backend_event (mysql_backend.c:228) -==12419== by 0x588CA2: process_pollq (poll.c:858) -==12419== by 0x58854B: poll_waitevents (poll.c:608) -==12419== by 0x57C11B: main (gateway.c:1792) -==12419== Address 0x186901f0 is 0 bytes inside a block of size 278 free'd -==12419== at 0x4C2AF6C: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) -==12419== by 0x57D806: dcb_final_free (dcb.c:406) -==12419== by 0x57DDE6: dcb_process_zombies (dcb.c:603) -==12419== by 0x588598: poll_waitevents (poll.c:613) -==12419== by 0x57C11B: main (gateway.c:1792) -==12419== -==12419== Invalid read of size 8 -==12419== at 0x1B1435FC: gw_send_authentication_to_backend (mysql_common.c:572) -==12419== by 0x1B13F90E: gw_read_backend_event (mysql_backend.c:228) -==12419== by 0x588CA2: process_pollq (poll.c:858) -==12419== by 0x58854B: poll_waitevents (poll.c:608) -==12419== by 0x57C11B: main (gateway.c:1792) -==12419== Address 0x186901f0 is 0 bytes inside a block of size 278 free'd -==12419== at 0x4C2AF6C: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) -==12419== by 0x57D806: dcb_final_free (dcb.c:406) -==12419== by 0x57DDE6: dcb_process_zombies (dcb.c:603) -==12419== by 0x588598: poll_waitevents (poll.c:613) -==12419== by 0x57C11B: main (gateway.c:1792) -==12419== -==12419== Invalid read of size 8 -==12419== at 0x1B143606: gw_send_authentication_to_backend (mysql_common.c:572) -==12419== by 0x1B13F90E: gw_read_backend_event (mysql_backend.c:228) -==12419== by 0x588CA2: process_pollq (poll.c:858) -==12419== by 0x58854B: poll_waitevents (poll.c:608) -==12419== by 0x57C11B: main (gateway.c:1792) -==12419== Address 0x186901f8 is 8 bytes inside a block of size 278 free'd -==12419== at 0x4C2AF6C: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) -==12419== by 0x57D806: dcb_final_free (dcb.c:406) -==12419== by 0x57DDE6: dcb_process_zombies (dcb.c:603) -==12419== by 0x588598: poll_waitevents (poll.c:613) -==12419== by 0x57C11B: main (gateway.c:1792) -==12419== -==12419== Invalid read of size 4 -==12419== at 0x1B143611: gw_send_authentication_to_backend (mysql_common.c:572) -==12419== by 0x1B13F90E: gw_read_backend_event (mysql_backend.c:228) -==12419== by 0x588CA2: process_pollq (poll.c:858) -==12419== by 0x58854B: poll_waitevents (poll.c:608) -==12419== by 0x57C11B: main (gateway.c:1792) -==12419== Address 0x18690200 is 16 bytes inside a block of size 278 free'd -==12419== at 0x4C2AF6C: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) -==12419== by 0x57D806: dcb_final_free (dcb.c:406) -==12419== by 0x57DDE6: dcb_process_zombies (dcb.c:603) -==12419== by 0x588598: poll_waitevents (poll.c:613) -==12419== by 0x57C11B: main (gateway.c:1792) -==12419== -==12419== Invalid read of size 1 -==12419== at 0x4C2CCA2: strlen (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) -==12419== by 0x1B143719: gw_send_authentication_to_backend (mysql_common.c:604) -==12419== by 0x1B13F90E: gw_read_backend_event (mysql_backend.c:228) -==12419== by 0x588CA2: process_pollq (poll.c:858) -==12419== by 0x58854B: poll_waitevents (poll.c:608) -==12419== by 0x57C11B: main (gateway.c:1792) -==12419== Address 0x18690204 is 20 bytes inside a block of size 278 free'd -==12419== at 0x4C2AF6C: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) -==12419== by 0x57D806: dcb_final_free (dcb.c:406) -==12419== by 0x57DDE6: dcb_process_zombies (dcb.c:603) -==12419== by 0x588598: poll_waitevents (poll.c:613) -==12419== by 0x57C11B: main (gateway.c:1792) -==12419== -==12419== Invalid read of size 1 -==12419== at 0x4C2CCB4: strlen (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) -==12419== by 0x1B143719: gw_send_authentication_to_backend (mysql_common.c:604) -==12419== by 0x1B13F90E: gw_read_backend_event (mysql_backend.c:228) -==12419== by 0x588CA2: process_pollq (poll.c:858) -==12419== by 0x58854B: poll_waitevents (poll.c:608) -==12419== by 0x57C11B: main (gateway.c:1792) -==12419== Address 0x18690205 is 21 bytes inside a block of size 278 free'd -==12419== at 0x4C2AF6C: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) -==12419== by 0x57D806: dcb_final_free (dcb.c:406) -==12419== by 0x57DDE6: dcb_process_zombies (dcb.c:603) -==12419== by 0x588598: poll_waitevents (poll.c:613) -==12419== by 0x57C11B: main (gateway.c:1792) -==12419== -==12419== Invalid read of size 1 -==12419== at 0x4C2CCA2: strlen (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) -==12419== by 0x1B143893: gw_send_authentication_to_backend (mysql_common.c:660) -==12419== by 0x1B13F90E: gw_read_backend_event (mysql_backend.c:228) -==12419== by 0x588CA2: process_pollq (poll.c:858) -==12419== by 0x58854B: poll_waitevents (poll.c:608) -==12419== by 0x57C11B: main (gateway.c:1792) -==12419== Address 0x18690204 is 20 bytes inside a block of size 278 free'd -==12419== at 0x4C2AF6C: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) -==12419== by 0x57D806: dcb_final_free (dcb.c:406) -==12419== by 0x57DDE6: dcb_process_zombies (dcb.c:603) -==12419== by 0x588598: poll_waitevents (poll.c:613) -==12419== by 0x57C11B: main (gateway.c:1792) -==12419== -==12419== Invalid read of size 1 -==12419== at 0x4C2CCB4: strlen (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) -==12419== by 0x1B143893: gw_send_authentication_to_backend (mysql_common.c:660) -==12419== by 0x1B13F90E: gw_read_backend_event (mysql_backend.c:228) -==12419== by 0x588CA2: process_pollq (poll.c:858) -==12419== by 0x58854B: poll_waitevents (poll.c:608) -==12419== by 0x57C11B: main (gateway.c:1792) -==12419== Address 0x18690205 is 21 bytes inside a block of size 278 free'd -==12419== at 0x4C2AF6C: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) -==12419== by 0x57D806: dcb_final_free (dcb.c:406) -==12419== by 0x57DDE6: dcb_process_zombies (dcb.c:603) -==12419== by 0x588598: poll_waitevents (poll.c:613) -==12419== by 0x57C11B: main (gateway.c:1792) -==12419== -==12419== Invalid read of size 1 -==12419== at 0x4C2DE21: memcpy@@GLIBC_2.14 (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) -==12419== by 0x1B1438AF: gw_send_authentication_to_backend (mysql_common.c:660) -==12419== by 0x1B13F90E: gw_read_backend_event (mysql_backend.c:228) -==12419== by 0x588CA2: process_pollq (poll.c:858) -==12419== by 0x58854B: poll_waitevents (poll.c:608) -==12419== by 0x57C11B: main (gateway.c:1792) -==12419== Address 0x1869020a is 26 bytes inside a block of size 278 free'd -==12419== at 0x4C2AF6C: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) -==12419== by 0x57D806: dcb_final_free (dcb.c:406) -==12419== by 0x57DDE6: dcb_process_zombies (dcb.c:603) -==12419== by 0x588598: poll_waitevents (poll.c:613) -==12419== by 0x57C11B: main (gateway.c:1792) -==12419== -==12419== Invalid read of size 2 -==12419== at 0x4C2DEA0: memcpy@@GLIBC_2.14 (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) -==12419== by 0x1B1438AF: gw_send_authentication_to_backend (mysql_common.c:660) -==12419== by 0x1B13F90E: gw_read_backend_event (mysql_backend.c:228) -==12419== by 0x588CA2: process_pollq (poll.c:858) -==12419== by 0x58854B: poll_waitevents (poll.c:608) -==12419== by 0x57C11B: main (gateway.c:1792) -==12419== Address 0x18690206 is 22 bytes inside a block of size 278 free'd -==12419== at 0x4C2AF6C: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) -==12419== by 0x57D806: dcb_final_free (dcb.c:406) -==12419== by 0x57DDE6: dcb_process_zombies (dcb.c:603) -==12419== by 0x588598: poll_waitevents (poll.c:613) -==12419== by 0x57C11B: main (gateway.c:1792) -==12419== -==12419== Invalid read of size 1 -==12419== at 0x4C2CCA2: strlen (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) -==12419== by 0x1B1438BE: gw_send_authentication_to_backend (mysql_common.c:661) -==12419== by 0x1B13F90E: gw_read_backend_event (mysql_backend.c:228) -==12419== by 0x588CA2: process_pollq (poll.c:858) -==12419== by 0x58854B: poll_waitevents (poll.c:608) -==12419== by 0x57C11B: main (gateway.c:1792) -==12419== Address 0x18690204 is 20 bytes inside a block of size 278 free'd -==12419== at 0x4C2AF6C: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) -==12419== by 0x57D806: dcb_final_free (dcb.c:406) -==12419== by 0x57DDE6: dcb_process_zombies (dcb.c:603) -==12419== by 0x588598: poll_waitevents (poll.c:613) -==12419== by 0x57C11B: main (gateway.c:1792) -==12419== -==12419== Invalid read of size 1 -==12419== at 0x4C2CCB4: strlen (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) -==12419== by 0x1B1438BE: gw_send_authentication_to_backend (mysql_common.c:661) -==12419== by 0x1B13F90E: gw_read_backend_event (mysql_backend.c:228) -==12419== by 0x588CA2: process_pollq (poll.c:858) -==12419== by 0x58854B: poll_waitevents (poll.c:608) -==12419== by 0x57C11B: main (gateway.c:1792) -==12419== Address 0x18690205 is 21 bytes inside a block of size 278 free'd -==12419== at 0x4C2AF6C: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) -==12419== by 0x57D806: dcb_final_free (dcb.c:406) -==12419== by 0x57DDE6: dcb_process_zombies (dcb.c:603) -==12419== by 0x588598: poll_waitevents (poll.c:613) -==12419== by 0x57C11B: main (gateway.c:1792) -Comment 1 Vilho Raatikka 2014-12-29 18:29:11 UTC - dcb_final_free:don't free dcb->data, it is either freed in session_alloc if session creation fails or in session_free only. - mysql_client.c:gw_mysql_do_authentication:if anything fails, and session_alloc won't be called, free dcb->data. - mysql_common.c:gw_send_authentication_to_backend:if session is already closing then return with error. -Comment 2 Markus Mäkelä 2014-12-30 08:58:59 UTC -Created attachment 170 [details] -failing configuration - -The attached configuration currently crashes into a debug assert in handleError in readconnroute.c when connecting to port 4006. If this is removed, the next point of failure is in dcb_final_free when the session->data object is freed. -Comment 3 Vilho Raatikka 2014-12-30 10:14:43 UTC -(In reply to comment #2) -> Created attachment 170 [details] -> failing configuration -> -> The attached configuration currently crashes into a debug assert in -> handleError in readconnroute.c when connecting to port 4006. If this is -> removed, the next point of failure is in dcb_final_free when the -> session->data object is freed. - -Should this be open or closed based on the information provided? -Comment 4 Markus Mäkelä 2014-12-30 10:17:55 UTC -My apologies, I thought I did reopen it. -Comment 5 Vilho Raatikka 2014-12-30 10:27:32 UTC -Fixed double freeing dcb->data if authentication phase fails. -Comment 6 Vilho Raatikka 2014-12-30 10:30:12 UTC -Reopen due to crash. Another double free somewhere. -Comment 7 Vilho Raatikka 2014-12-30 11:36:38 UTC -Cloned session was freeing the shared 'data' dcb->data/session->data. Now only session_free for the non-clone session is allowed to free the data. - -*/ - - - -#include -#include #include "testconnections.h" -using namespace std; - int main(int argc, char *argv[]) { - - TestConnections * Test = new TestConnections(argc, argv); - Test->set_timeout(20); - - Test->connect_maxscale(); - - Test->tprintf("Trying query to ReadConn master\n"); - fflush(stdout); - Test->try_query(Test->conn_master, "show processlist;"); - Test->tprintf("Trying query to ReadConn slave\n"); - Test->try_query(Test->conn_slave, "show processlist;"); - - Test->close_maxscale_connections(); - - Test->check_log_err((char *) "Creating client session for Tee filter failed. Terminating session.", true); - Test->check_log_err((char *) "Failed to create filter 'DuplicaFilter' for service 'RW_Router'", true); - - int rval = Test->global_result; - delete Test; - return rval; + TestConnections test(argc, argv); + test.check_maxscale_alive(); + test.check_log_err("Failed to create new router session for service 'RW_Split'", true); + return test.global_result; } - diff --git a/maxscale-system-test/bug673.cpp b/maxscale-system-test/bug673.cpp index 2977bb2aa..860281c78 100644 --- a/maxscale-system-test/bug673.cpp +++ b/maxscale-system-test/bug673.cpp @@ -1,9 +1,10 @@ /** * @file bug673.cpp regression case for bug673 ("MaxScale crashes if "Users table data" is empty and "show dbusers" is executed in maxadmin") * - * - configure wrong IP for all backends - * - execute maxadmin command show dbusers "RW Split Router" - * - check MaxScale is alive by executing maxadmin again + * - Configure wrong IP for all backends + * - Execute maxadmin command show dbusers "RW Split Router" + * - Check MaxScale is alive by executing maxadmin again + * - Check that only new style object names in maxadmin commands are accepted */ #include "testconnections.h" @@ -11,20 +12,17 @@ int main(int argc, char *argv[]) { - char result[1024]; - TestConnections * Test = new TestConnections(argc, argv); - - Test->set_timeout(20); + TestConnections test(argc, argv); + test.set_timeout(60); for (int i = 0; i < 2; i++) { - Test->tprintf("Trying show dbusers \"RW Split Router\"\n"); - Test->add_result(Test->get_maxadmin_param((char *) "show dbusers \"RW Split Router\"", (char *) "User names:", - result), "Maxadmin failed\n"); - Test->tprintf("result %s\n", result); + char result[1024]; + test.add_result(test.get_maxadmin_param("show dbusers \"RW Split Router\"", "User names:", result) == 0, + "Old style objects in maxadmin commands should fail"); + test.add_result(test.get_maxadmin_param("show dbusers RW-Split-Router", "User names:", result), + "New style objects in maxadmin commands should succeed"); } - int rval = Test->global_result; - delete Test; - return rval; + return test.global_result; } diff --git a/maxscale-system-test/fwf_reload.cpp b/maxscale-system-test/fwf_reload.cpp index 77a5e4851..ebec2dfa8 100644 --- a/maxscale-system-test/fwf_reload.cpp +++ b/maxscale-system-test/fwf_reload.cpp @@ -100,7 +100,7 @@ int main(int argc, char *argv[]) copy_rules(Test, (char *) "rules_syntax_error", rules_dir); char *output = Test->ssh_maxscale_output(true, - "maxadmin call command dbfwfilter rules/reload \"Database Firewall\""); + "maxadmin call command dbfwfilter rules/reload Database-Firewall"); Test->add_result(strcasestr(output, "Failed") == NULL, "Reloading rules should fail with syntax errors"); Test->check_maxscale_processes(1); diff --git a/maxscale-system-test/mxs874_slave_recovery.cpp b/maxscale-system-test/mxs874_slave_recovery.cpp index f3ebe8856..0e6d60805 100644 --- a/maxscale-system-test/mxs874_slave_recovery.cpp +++ b/maxscale-system-test/mxs874_slave_recovery.cpp @@ -18,37 +18,37 @@ using namespace std; int main(int argc, char *argv[]) { - TestConnections * Test = new TestConnections(argc, argv); - Test->set_timeout(10); + TestConnections test(argc, argv); + test.set_timeout(10); - Test->connect_maxscale(); + test.connect_maxscale(); - Test->set_timeout(10); - Test->try_query(Test->conn_rwsplit, (char *) "SET @a=1"); - Test->stop_timeout(); + test.set_timeout(10); + test.try_query(test.conn_rwsplit, (char *) "SET @a=1"); + test.stop_timeout(); sleep(1); - Test->set_timeout(20); - Test->tprintf("Blocking first slave\n"); - Test->repl->block_node(1); - Test->stop_timeout(); + test.set_timeout(20); + test.tprintf("Blocking first slave\n"); + test.repl->block_node(1); + test.stop_timeout(); sleep(5); - Test->set_timeout(10); - Test->tprintf("Unblocking first slave and blocking second slave\n"); + test.set_timeout(10); + test.tprintf("Unblocking first slave and blocking second slave\n"); - Test->repl->unblock_node(1); - Test->stop_timeout(); + test.repl->unblock_node(1); + test.stop_timeout(); sleep(5); - Test->repl->block_node(2); - Test->stop_timeout(); + test.repl->block_node(2); + test.stop_timeout(); sleep(5); - Test->set_timeout(20); + test.set_timeout(20); int retries; for (retries = 0; retries < 10; retries++) { char server1_status[256]; - Test->get_maxadmin_param((char *) "show server server2", (char *) "Status", server1_status); + test.get_maxadmin_param((char *) "show server server2", (char *) "Status", server1_status); if (strstr(server1_status, "Running")) { break; @@ -56,28 +56,26 @@ int main(int argc, char *argv[]) sleep(1); } - Test->add_result(retries == 10, "Slave is not recovered, slave status is not Running\n"); + test.add_result(retries == 10, "Slave is not recovered, slave status is not Running\n"); - Test->repl->connect(); - int real_id = Test->repl->get_server_id(1); + test.repl->connect(); + int real_id = test.repl->get_server_id(1); char server_id[200] = ""; - find_field(Test->conn_rwsplit, "SELECT @@server_id", "@@server_id", server_id); + find_field(test.conn_rwsplit, "SELECT @@server_id", "@@server_id", server_id); int queried_id = atoi(server_id); - Test->add_result(queried_id != real_id, "The query server ID '%d' does not match the one from server '%d'. " + test.add_result(queried_id != real_id, "The query server ID '%d' does not match the one from server '%d'. " "Slave was not recovered.", queried_id, real_id); char userval[200] = ""; - find_field(Test->conn_rwsplit, "SELECT @a", "@a", userval); + find_field(test.conn_rwsplit, "SELECT @a", "@a", userval); - Test->add_result(atoi(userval) != 1, "User variable @a is not 1, it is '%s'", userval); + test.add_result(atoi(userval) != 1, "User variable @a is not 1, it is '%s'", userval); - Test->tprintf("Unblocking second slave\n"); - Test->repl->unblock_node(2); + test.tprintf("Unblocking second slave\n"); + test.repl->unblock_node(2); - Test->check_maxscale_alive(); - int rval = Test->global_result; - delete Test; - return rval; + test.check_maxscale_alive(); + return test.global_result; }