From 6279ab350c7c950593843b23edcd65e100d7b3d6 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Mon, 10 Sep 2018 10:24:46 +0300 Subject: [PATCH] Rename TestConnections::assert() to TestConnections::expect() Allows the including of . --- maxscale-system-test/compound_statement.cpp | 2 +- maxscale-system-test/different_size.cpp | 2 +- .../fail_switch_rejoin_common.cpp | 6 +++--- maxscale-system-test/failover_common.cpp | 12 ++++++------ maxscale-system-test/local_address.cpp | 6 +++--- maxscale-system-test/maxctrl_basic.cpp | 12 ++++++------ .../mxs1713_lots_of_databases.cpp | 2 +- maxscale-system-test/mxs1719.cpp | 10 +++++----- .../mxs1731_old_persisted_config.cpp | 4 ++-- maxscale-system-test/mxs1743_rconn_bitmask.cpp | 2 +- .../mxs1760_use_sql_variables_in.cpp | 2 +- maxscale-system-test/mxs1776_ps_exec_hang.cpp | 6 +++--- maxscale-system-test/mxs1787_call_ps.cpp | 8 ++++---- maxscale-system-test/mxs1804_long_ps_hang.cpp | 2 +- maxscale-system-test/mxs1808_long_data.cpp | 2 +- maxscale-system-test/mxs1824_double_cursor.cpp | 18 +++++++++--------- maxscale-system-test/mxs1831_unknown_param.cpp | 4 ++-- .../mxs1836_show_eventTimes.cpp | 12 ++++++------ maxscale-system-test/mxs1889.cpp | 8 ++++---- maxscale-system-test/mxs1899_generated_cnf.cpp | 2 +- maxscale-system-test/mxs1932_hidden_cnf.cpp | 2 +- maxscale-system-test/mxs1958_insert_priv.cpp | 2 +- .../mxs1961_standalone_rejoin.cpp | 6 +++--- maxscale-system-test/mxs872_roles.cpp | 6 +++--- .../mysqlmon_detect_standalone_master.cpp | 6 +++--- .../mysqlmon_external_master.cpp | 2 +- .../mysqlmon_failover_no_slaves.cpp | 2 +- .../mysqlmon_failover_stress.cpp | 10 +++++----- maxscale-system-test/mysqlmon_rejoin_bad.cpp | 18 +++++++++--------- maxscale-system-test/mysqlmon_rejoin_bad2.cpp | 6 +++--- maxscale-system-test/mysqlmon_rejoin_good.cpp | 6 +++--- .../mysqlmon_rejoin_manual.cpp | 6 +++--- .../mysqlmon_rejoin_manual2.cpp | 14 +++++++------- maxscale-system-test/mysqlmon_switchover.cpp | 2 +- .../mysqlmon_switchover_stress.cpp | 14 +++++++------- maxscale-system-test/sequence.cpp | 4 ++-- maxscale-system-test/testconnections.cpp | 4 ++-- maxscale-system-test/testconnections.h | 2 +- 38 files changed, 117 insertions(+), 117 deletions(-) diff --git a/maxscale-system-test/compound_statement.cpp b/maxscale-system-test/compound_statement.cpp index e2f0f24ba..8df8d89bc 100644 --- a/maxscale-system-test/compound_statement.cpp +++ b/maxscale-system-test/compound_statement.cpp @@ -28,7 +28,7 @@ int main(int argc, char** argv) // Do the select inside a transacttion so that it gets routed to the master test.try_query(test.maxscales->conn_rwsplit[0], "BEGIN"); - test.assert(execute_query_check_one(test.maxscales->conn_rwsplit[0], "SELECT id FROM test.t1", "2") == 0, + test.expect(execute_query_check_one(test.maxscales->conn_rwsplit[0], "SELECT id FROM test.t1", "2") == 0, "Table should contain one row with value 2"); test.try_query(test.maxscales->conn_rwsplit[0], "COMMIT"); diff --git a/maxscale-system-test/different_size.cpp b/maxscale-system-test/different_size.cpp index 171ab7b52..a738dc785 100644 --- a/maxscale-system-test/different_size.cpp +++ b/maxscale-system-test/different_size.cpp @@ -85,7 +85,7 @@ void different_packet_size(TestConnections* Test, bool binlog) char* event = create_event_size(size); conn = connect_to_serv(Test, binlog); - Test->assert(execute_query_silent(conn, event) == 0, "Query should succeed"); + Test->expect(execute_query_silent(conn, event) == 0, "Query should succeed"); free(event); execute_query_silent(conn, (char *) "DELETE FROM test.large_event"); mysql_close(conn); diff --git a/maxscale-system-test/fail_switch_rejoin_common.cpp b/maxscale-system-test/fail_switch_rejoin_common.cpp index baf556d0d..ccb6541da 100644 --- a/maxscale-system-test/fail_switch_rejoin_common.cpp +++ b/maxscale-system-test/fail_switch_rejoin_common.cpp @@ -159,7 +159,7 @@ bool generate_traffic_and_check(TestConnections& test, MYSQL* conn, int insert_c mysql_query(conn, SELECT); MYSQL_RES *res = mysql_store_result(conn); - test.assert(res != NULL, "Query did not return a result set"); + test.expect(res != NULL, "Query did not return a result set"); if (res) { @@ -172,14 +172,14 @@ bool generate_traffic_and_check(TestConnections& test, MYSQL* conn, int insert_c int value_read = strtol(row[0], NULL, 0); if (value_read != expected_val) { - test.assert(false, "Query returned %d when %d was expected", value_read, expected_val); + test.expect(false, "Query returned %d when %d was expected", value_read, expected_val); rval = false; break; } expected_val++; } int num_rows = expected_val; - test.assert(num_rows == inserts, "Query returned %d rows when %d rows were expected", + test.expect(num_rows == inserts, "Query returned %d rows when %d rows were expected", num_rows, inserts); if (num_rows != inserts) { diff --git a/maxscale-system-test/failover_common.cpp b/maxscale-system-test/failover_common.cpp index deb84be56..e0c422c61 100644 --- a/maxscale-system-test/failover_common.cpp +++ b/maxscale-system-test/failover_common.cpp @@ -33,7 +33,7 @@ void reset_replication(TestConnections& test) test.maxscales->wait_for_monitor(2); master_id = get_master_server_id(test); cout << "Master server id is now back to " << master_id << endl; - test.assert(master_id == 1, "Switchover back to server1 failed"); + test.expect(master_id == 1, "Switchover back to server1 failed"); } get_output(test); StringSet node_states; @@ -43,7 +43,7 @@ void reset_replication(TestConnections& test) servername << "server" << i; node_states = test.get_server_status(servername.str().c_str()); bool states_ok = (node_states.find("Slave") != node_states.end()); - test.assert(states_ok, "Server %d is not replicating.", i); + test.expect(states_ok, "Server %d is not replicating.", i); } } @@ -63,7 +63,7 @@ void check_test_1(TestConnections& test, int node0_id) get_output(test); int master_id = get_master_server_id(test); cout << "Master server id is " << master_id << endl; - test.assert(master_id > 0 && master_id != node0_id, "Master did not change or no master detected."); + test.expect(master_id > 0 && master_id != node0_id, "Master did not change or no master detected."); if (test.global_result == 0) { check(test); @@ -98,7 +98,7 @@ void check_test_2(TestConnections& test) cout << "Master server id is " << master_id << endl; bool success = (master_id > 0 && (master_id == test.repl->get_server_id(2) || master_id == test.repl->get_server_id(3))); - test.assert(success, WRONG_SLAVE); + test.expect(success, WRONG_SLAVE); if (test.global_result == 0) { check(test); @@ -109,7 +109,7 @@ void check_test_2(TestConnections& test) test.maxscales->wait_for_monitor(2); get_output(test); StringSet node_states = test.get_server_status("server2"); - test.assert(node_states.find("Slave") != node_states.end(), "Server 2 is not replicating."); + test.expect(node_states.find("Slave") != node_states.end(), "Server 2 is not replicating."); if (test.global_result == 0) { reset_replication(test); @@ -167,7 +167,7 @@ void check_test_3(TestConnections& test) // Because servers have been restarted, redo connections. test.repl->connect(); cout << "Master server id is " << master_id << endl; - test.assert(master_id > 0 && master_id == test.repl->get_server_id(3), WRONG_SLAVE); + test.expect(master_id > 0 && master_id == test.repl->get_server_id(3), WRONG_SLAVE); print_gtids(test); reset_replication(test); diff --git a/maxscale-system-test/local_address.cpp b/maxscale-system-test/local_address.cpp index cceef3cc6..79313c103 100644 --- a/maxscale-system-test/local_address.cpp +++ b/maxscale-system-test/local_address.cpp @@ -240,11 +240,11 @@ void test_connecting(TestConnections& test, if (!could_connect && should_be_able_to) { - test.assert(false, "%s@%s should have been able to connect, but wasn't.", zUser, zHost); + test.expect(false, "%s@%s should have been able to connect, but wasn't.", zUser, zHost); } else if (could_connect && !should_be_able_to) { - test.assert(false, "%s@%s should NOT have been able to connect, but was.", zUser, zHost); + test.expect(false, "%s@%s should NOT have been able to connect, but was.", zUser, zHost); } else { @@ -348,7 +348,7 @@ int main(int argc, char** argv) } else { - test.assert(false, "MaxScale node does not have at least one IP-address."); + test.expect(false, "MaxScale node does not have at least one IP-address."); } return test.global_result; diff --git a/maxscale-system-test/maxctrl_basic.cpp b/maxscale-system-test/maxctrl_basic.cpp index 6322d989a..9ff8c3e8f 100644 --- a/maxscale-system-test/maxctrl_basic.cpp +++ b/maxscale-system-test/maxctrl_basic.cpp @@ -9,22 +9,22 @@ int main(int argc, char** argv) TestConnections test(argc, argv); int rc = test.maxscales->ssh_node_f(0, false, "maxctrl help list servers"); - test.assert(rc == 0, "`help list servers` should work"); + test.expect(rc == 0, "`help list servers` should work"); rc = test.maxscales->ssh_node_f(0, false, "maxctrl --tsv list servers|grep 'Master, Running'"); - test.assert(rc == 0, "`list servers` should return at least one row with: Master, Running"); + test.expect(rc == 0, "`list servers` should return at least one row with: Master, Running"); rc = test.maxscales->ssh_node_f(0, false, "maxctrl set server server1 maintenance"); - test.assert(rc == 0, "`set server` should work"); + test.expect(rc == 0, "`set server` should work"); rc = test.maxscales->ssh_node_f(0, false, "maxctrl --tsv list servers|grep 'Maintenance'"); - test.assert(rc == 0, "`list servers` should return at least one row with: Maintanance"); + test.expect(rc == 0, "`list servers` should return at least one row with: Maintanance"); rc = test.maxscales->ssh_node_f(0, false, "maxctrl clear server server1 maintenance"); - test.assert(rc == 0, "`clear server` should work"); + test.expect(rc == 0, "`clear server` should work"); rc = test.maxscales->ssh_node_f(0, false, "maxctrl --tsv list servers|grep 'Maintenance'"); - test.assert(rc != 0, "`list servers` should have no rows with: Maintanance"); + test.expect(rc != 0, "`list servers` should have no rows with: Maintanance"); test.check_maxscale_alive(); return test.global_result; diff --git a/maxscale-system-test/mxs1713_lots_of_databases.cpp b/maxscale-system-test/mxs1713_lots_of_databases.cpp index cb20bdafb..45aefc729 100644 --- a/maxscale-system-test/mxs1713_lots_of_databases.cpp +++ b/maxscale-system-test/mxs1713_lots_of_databases.cpp @@ -43,7 +43,7 @@ int main(int argc, char** argv) } test.tprintf("Done!"); - test.assert(errors.empty(), "None of the queries should fail: %s", + test.expect(errors.empty(), "None of the queries should fail: %s", std::accumulate(errors.begin(), errors.end(), std::string(), [](const std::string &a, const std::string &b) { return a + b + " "; diff --git a/maxscale-system-test/mxs1719.cpp b/maxscale-system-test/mxs1719.cpp index 660ba5520..3acd5d04b 100644 --- a/maxscale-system-test/mxs1719.cpp +++ b/maxscale-system-test/mxs1719.cpp @@ -33,7 +33,7 @@ void run(TestConnections& test) init(test); MYSQL* pMysql = mysql_init(NULL); - test.assert(pMysql, "Could not create MYSQL handle."); + test.expect(pMysql, "Could not create MYSQL handle."); const char* zUser = test.maxscales->user_name; const char* zPassword = test.maxscales->password; @@ -57,7 +57,7 @@ void run(TestConnections& test) } else { - test.assert(false, "Could not connect to MaxScale."); + test.expect(false, "Could not connect to MaxScale."); } } @@ -84,17 +84,17 @@ int main(int argc, char* argv[]) } else { - test.assert(false, "Could not connect to RWS."); + test.expect(false, "Could not connect to RWS."); } } else { - test.assert(false, "Could not start MaxScale."); + test.expect(false, "Could not start MaxScale."); } } else { - test.assert(false, "Could not copy masking file to MaxScale node."); + test.expect(false, "Could not copy masking file to MaxScale node."); } return test.global_result; diff --git a/maxscale-system-test/mxs1731_old_persisted_config.cpp b/maxscale-system-test/mxs1731_old_persisted_config.cpp index 38846ce1e..e8e72cb40 100644 --- a/maxscale-system-test/mxs1731_old_persisted_config.cpp +++ b/maxscale-system-test/mxs1731_old_persisted_config.cpp @@ -33,7 +33,7 @@ int main(int argc, char** argv) test.check_maxscale_alive(); int rc = test.maxscales->ssh_node_f(0, true, "grep 'version_string' /var/lib/maxscale/maxscale.cnf.d/RW-Split-Router.cnf"); - test.assert(rc == 0, "Generated configuration should have version_string defined and MaxScale should ignore it."); + test.expect(rc == 0, "Generated configuration should have version_string defined and MaxScale should ignore it."); test.maxscales->ssh_node_f(0, true, "maxadmin alter service RW-Split-Router enable_root_user=false"); @@ -41,7 +41,7 @@ int main(int argc, char** argv) test.check_maxscale_alive(); rc = test.maxscales->ssh_node_f(0, true, "grep 'version_string' /var/lib/maxscale/maxscale.cnf.d/RW-Split-Router.cnf"); - test.assert(rc != 0, "Generated configuration should not have version_string defined."); + test.expect(rc != 0, "Generated configuration should not have version_string defined."); return test.global_result; } diff --git a/maxscale-system-test/mxs1743_rconn_bitmask.cpp b/maxscale-system-test/mxs1743_rconn_bitmask.cpp index 237237b50..a4bb46fbd 100644 --- a/maxscale-system-test/mxs1743_rconn_bitmask.cpp +++ b/maxscale-system-test/mxs1743_rconn_bitmask.cpp @@ -65,7 +65,7 @@ int main(int argc, char** argv) find_field(test.repl->nodes[0], query.c_str(), "connections", master_connections); find_field(test.repl->nodes[1], query.c_str(), "connections", slave_connections); - test.assert(strcmp(master_connections, slave_connections) == 0, + test.expect(strcmp(master_connections, slave_connections) == 0, "Master and slave shoud have the same amount of connections: %s != %s", master_connections, slave_connections); diff --git a/maxscale-system-test/mxs1760_use_sql_variables_in.cpp b/maxscale-system-test/mxs1760_use_sql_variables_in.cpp index 067d81d13..b7f4dd03d 100644 --- a/maxscale-system-test/mxs1760_use_sql_variables_in.cpp +++ b/maxscale-system-test/mxs1760_use_sql_variables_in.cpp @@ -23,7 +23,7 @@ int main(int argc, char** argv) cout << "Setting variable @a to 123" << endl; mysql_query(test.maxscales->conn_rwsplit[0], "SET @a = 123"); int rc = execute_query_check_one(test.maxscales->conn_rwsplit[0], "SELECT @a", "123"); - test.assert(rc == 0, "Text protocol should return 123 as the value of @a"); + test.expect(rc == 0, "Text protocol should return 123 as the value of @a"); cout << "Preparing and executing " << NUM_STMT << " prepared statements" << endl; for (int i = 0; i < NUM_STMT && test.global_result == 0; i++) diff --git a/maxscale-system-test/mxs1776_ps_exec_hang.cpp b/maxscale-system-test/mxs1776_ps_exec_hang.cpp index 2f1d241b5..b9fdb4548 100644 --- a/maxscale-system-test/mxs1776_ps_exec_hang.cpp +++ b/maxscale-system-test/mxs1776_ps_exec_hang.cpp @@ -45,16 +45,16 @@ void run_test(TestConnections& test, TestCase test_case) if (mysql_stmt_prepare(stmt, query.c_str(), query.size())) { - test.assert(false, "Prepared statement failure: %s", mysql_stmt_error(stmt)); + test.expect(false, "Prepared statement failure: %s", mysql_stmt_error(stmt)); } cout << test_case.name << endl; - test.assert(test_case.func(test.maxscales->conn_rwsplit[0], stmt, bind), "Test '%s' failed", + test.expect(test_case.func(test.maxscales->conn_rwsplit[0], stmt, bind), "Test '%s' failed", test_case.name.c_str()); mysql_stmt_close(stmt); - test.assert(mysql_query(test.maxscales->conn_rwsplit[0], "SELECT 1") == 0, "Normal queries should work"); + test.expect(mysql_query(test.maxscales->conn_rwsplit[0], "SELECT 1") == 0, "Normal queries should work"); test.maxscales->disconnect(); } diff --git a/maxscale-system-test/mxs1787_call_ps.cpp b/maxscale-system-test/mxs1787_call_ps.cpp index 364026874..292c1f426 100644 --- a/maxscale-system-test/mxs1787_call_ps.cpp +++ b/maxscale-system-test/mxs1787_call_ps.cpp @@ -46,16 +46,16 @@ int main(int argc, char* argv[]) test.set_timeout(30); - test.assert(mysql_stmt_prepare(stmt, query.c_str(), query.size()) == 0, + test.expect(mysql_stmt_prepare(stmt, query.c_str(), query.size()) == 0, "Prepared statement failure: %s", mysql_stmt_error(stmt)); - test.assert(mysql_stmt_bind_param(stmt, &bind.bind) == 0, + test.expect(mysql_stmt_bind_param(stmt, &bind.bind) == 0, "Bind failure: %s", mysql_stmt_error(stmt)); - test.assert(mysql_stmt_execute(stmt) == 0, + test.expect(mysql_stmt_execute(stmt) == 0, "Execute failure: %s", mysql_stmt_error(stmt)); mysql_stmt_close(stmt); - test.assert(mysql_query(test.maxscales->conn_rwsplit[0], "SELECT 1") == 0, "Normal queries should work"); + test.expect(mysql_query(test.maxscales->conn_rwsplit[0], "SELECT 1") == 0, "Normal queries should work"); test.maxscales->disconnect(); return test.global_result; diff --git a/maxscale-system-test/mxs1804_long_ps_hang.cpp b/maxscale-system-test/mxs1804_long_ps_hang.cpp index 2479bee33..70932e798 100644 --- a/maxscale-system-test/mxs1804_long_ps_hang.cpp +++ b/maxscale-system-test/mxs1804_long_ps_hang.cpp @@ -33,7 +33,7 @@ int main(int argc, char** argv) test.maxscales->connect(); MYSQL_STMT* stmt = mysql_stmt_init(test.maxscales->conn_rwsplit[0]); - test.assert(mysql_stmt_prepare(stmt, sqlstr, strlen(sqlstr)) != 0, "Prepare should fail in 2.2 but not hang", + test.expect(mysql_stmt_prepare(stmt, sqlstr, strlen(sqlstr)) != 0, "Prepare should fail in 2.2 but not hang", mysql_stmt_error(stmt)); mysql_stmt_close(stmt); diff --git a/maxscale-system-test/mxs1808_long_data.cpp b/maxscale-system-test/mxs1808_long_data.cpp index b32af6788..ecc9d8359 100644 --- a/maxscale-system-test/mxs1808_long_data.cpp +++ b/maxscale-system-test/mxs1808_long_data.cpp @@ -79,7 +79,7 @@ int main(int argc, char** argv) TestConnections test(argc, argv); test.maxscales->connect(); - test.assert(test_long_data(test.maxscales->conn_rwsplit[0], 123456), "Test should work"); + test.expect(test_long_data(test.maxscales->conn_rwsplit[0], 123456), "Test should work"); test.maxscales->disconnect(); return test.global_result; diff --git a/maxscale-system-test/mxs1824_double_cursor.cpp b/maxscale-system-test/mxs1824_double_cursor.cpp index 87271df70..6b8bcc78a 100644 --- a/maxscale-system-test/mxs1824_double_cursor.cpp +++ b/maxscale-system-test/mxs1824_double_cursor.cpp @@ -18,9 +18,9 @@ void double_cursor(TestConnections& test, MYSQL* conn) MYSQL_STMT* stmt1 = mysql_stmt_init(conn); const char* query = "SELECT id FROM test.t1"; int rc = mysql_stmt_prepare(stmt1, query, strlen(query)); - test.assert(rc == 0, "First prepare should work: %s %s", mysql_stmt_error(stmt1), mysql_error(conn)); + test.expect(rc == 0, "First prepare should work: %s %s", mysql_stmt_error(stmt1), mysql_error(conn)); unsigned long type = CURSOR_TYPE_READ_ONLY; - test.assert(mysql_stmt_attr_set(stmt1, STMT_ATTR_CURSOR_TYPE, &type) == 0, + test.expect(mysql_stmt_attr_set(stmt1, STMT_ATTR_CURSOR_TYPE, &type) == 0, "Set of first attribute should work: %s %s", mysql_stmt_error(stmt1), mysql_error(conn)); @@ -30,26 +30,26 @@ void double_cursor(TestConnections& test, MYSQL* conn) bind[0].buffer = &id; mysql_stmt_bind_result(stmt1, bind); - test.assert(mysql_stmt_execute(stmt1) == 0, "Execute of first statement should work: %s %s", + test.expect(mysql_stmt_execute(stmt1) == 0, "Execute of first statement should work: %s %s", mysql_stmt_error(stmt1), mysql_error(conn)); - test.assert(mysql_stmt_fetch(stmt1) == 0, "First fetch should work: %s %s", + test.expect(mysql_stmt_fetch(stmt1) == 0, "First fetch should work: %s %s", mysql_stmt_error(stmt1), mysql_error(conn)); MYSQL_STMT* stmt2 = mysql_stmt_init(conn); rc = mysql_stmt_prepare(stmt2, query, strlen(query)); - test.assert(rc == 0, "Second prepare should work: %s %s", mysql_stmt_error(stmt2), mysql_error(conn)); - test.assert(mysql_stmt_attr_set(stmt2, STMT_ATTR_CURSOR_TYPE, &type) == 0, + test.expect(rc == 0, "Second prepare should work: %s %s", mysql_stmt_error(stmt2), mysql_error(conn)); + test.expect(mysql_stmt_attr_set(stmt2, STMT_ATTR_CURSOR_TYPE, &type) == 0, "Set of second attribute should work: %s %s", mysql_stmt_error(stmt2), mysql_error(conn)); mysql_stmt_bind_result(stmt2, bind); - test.assert(mysql_stmt_execute(stmt2) == 0, "Execute of second statement should work: %s %s", + test.expect(mysql_stmt_execute(stmt2) == 0, "Execute of second statement should work: %s %s", mysql_stmt_error(stmt2), mysql_error(conn)); - test.assert(mysql_stmt_fetch(stmt2) == 0, "Second fetch should work: %s %s", mysql_stmt_error(stmt2), + test.expect(mysql_stmt_fetch(stmt2) == 0, "Second fetch should work: %s %s", mysql_stmt_error(stmt2), mysql_error(conn)); mysql_stmt_reset(stmt2); - test.assert(mysql_stmt_fetch(stmt1) == 0, "Third fetch should work: %s %s", mysql_stmt_error(stmt1), + test.expect(mysql_stmt_fetch(stmt1) == 0, "Third fetch should work: %s %s", mysql_stmt_error(stmt1), mysql_error(conn)); mysql_stmt_close(stmt1); diff --git a/maxscale-system-test/mxs1831_unknown_param.cpp b/maxscale-system-test/mxs1831_unknown_param.cpp index e42c2861e..d094ff1c9 100644 --- a/maxscale-system-test/mxs1831_unknown_param.cpp +++ b/maxscale-system-test/mxs1831_unknown_param.cpp @@ -11,9 +11,9 @@ int main(int argc, char** argv) TestConnections test(argc, argv); int rc = test.maxscales->ssh_node_f(0, true, "maxctrl alter monitor MySQL-Monitor not_a_parameter not_a_value|grep Error"); - test.assert(rc == 0, "Altering unknown parameter should cause an error"); + test.expect(rc == 0, "Altering unknown parameter should cause an error"); rc = test.maxscales->ssh_node_f(0, true, "maxctrl alter monitor MySQL-Monitor ignore_external_masters on_sunday_afternoons|grep Error"); - test.assert(rc == 0, "Invalid parameter value should cause an error"); + test.expect(rc == 0, "Invalid parameter value should cause an error"); return test.global_result; } diff --git a/maxscale-system-test/mxs1836_show_eventTimes.cpp b/maxscale-system-test/mxs1836_show_eventTimes.cpp index f719bae99..1d44c7a02 100644 --- a/maxscale-system-test/mxs1836_show_eventTimes.cpp +++ b/maxscale-system-test/mxs1836_show_eventTimes.cpp @@ -29,12 +29,12 @@ void run(TestConnections& test, MYSQL* pMysql) if (mysql_query(pMysql, "show eventTimes") == 0) { MYSQL_RES* pResult = mysql_store_result(pMysql); - test.assert(pResult, "Executing 'show eventTimes' returned no result."); + test.expect(pResult, "Executing 'show eventTimes' returned no result."); if (pResult) { int nFields = mysql_field_count(pMysql); - test.assert(nFields == 3, "Expected 3 fields, got %d.", nFields); + test.expect(nFields == 3, "Expected 3 fields, got %d.", nFields); MYSQL_ROW row; while ((row = mysql_fetch_row(pResult)) != NULL) @@ -47,9 +47,9 @@ void run(TestConnections& test, MYSQL* pMysql) int64_t nEvents_queued = strtoll(row[1], NULL, 0); int64_t nEvents_executed = strtoll(row[2], NULL, 0); - test.assert(nEvents_queued >= 0 && nEvents_queued < 100, + test.expect(nEvents_queued >= 0 && nEvents_queued < 100, "Suspiciously large number of 'No. Events Queued'."); - test.assert(nEvents_executed >= 0 && nEvents_executed < 100, + test.expect(nEvents_executed >= 0 && nEvents_executed < 100, "Suspiciously large number of 'No. Events Executed'."); } @@ -58,7 +58,7 @@ void run(TestConnections& test, MYSQL* pMysql) } else { - test.assert(false, "Executing 'show eventTimes' failed: %s", mysql_error(pMysql)); + test.expect(false, "Executing 'show eventTimes' failed: %s", mysql_error(pMysql)); } } @@ -71,7 +71,7 @@ int main(int argc, char* argv[]) const char* zMaxScale_host = test.maxscales->ip(0); MYSQL* pMysql = open_conn_no_db(PORT, zMaxScale_host, USER, PASSWD); - test.assert(pMysql, "Could not connect to maxinfo on MaxScale."); + test.expect(pMysql, "Could not connect to maxinfo on MaxScale."); if (pMysql) { diff --git a/maxscale-system-test/mxs1889.cpp b/maxscale-system-test/mxs1889.cpp index 78524dafa..32f93d539 100644 --- a/maxscale-system-test/mxs1889.cpp +++ b/maxscale-system-test/mxs1889.cpp @@ -23,15 +23,15 @@ string get_server_id(TestConnections& test, MYSQL* pMysql) if (rv == 0) { MYSQL_RES* pResult = mysql_store_result(pMysql); - test.assert(pResult, "Could not store result."); + test.expect(pResult, "Could not store result."); if (pResult) { unsigned int n = mysql_field_count(pMysql); - test.assert(n == 1, "Unexpected number of fields."); + test.expect(n == 1, "Unexpected number of fields."); MYSQL_ROW pzRow = mysql_fetch_row(pResult); - test.assert(pzRow, "Returned row was NULL."); + test.expect(pzRow, "Returned row was NULL."); if (pzRow) { @@ -79,7 +79,7 @@ int main(int argc, char** argv) string slave_id = get_server_id(test, test.maxscales->conn_slave[0]); test.tprintf("Server id: %s", slave_id.c_str()); - test.assert(slave_id != master_id, "Expected something else but %s", master_id.c_str()); + test.expect(slave_id != master_id, "Expected something else but %s", master_id.c_str()); return test.global_result; } diff --git a/maxscale-system-test/mxs1899_generated_cnf.cpp b/maxscale-system-test/mxs1899_generated_cnf.cpp index 308851155..69956fe1f 100644 --- a/maxscale-system-test/mxs1899_generated_cnf.cpp +++ b/maxscale-system-test/mxs1899_generated_cnf.cpp @@ -11,7 +11,7 @@ int main(int argc, char** argv) TestConnections test(argc, argv); test.maxscales->ssh_node_f(0, true, "maxctrl alter maxscale auth_connect_timeout 10"); - test.assert(test.maxscales->restart() == 0, "Restarting MaxScale after modification " + test.expect(test.maxscales->restart() == 0, "Restarting MaxScale after modification " "of global parameters should work"); return test.global_result; diff --git a/maxscale-system-test/mxs1932_hidden_cnf.cpp b/maxscale-system-test/mxs1932_hidden_cnf.cpp index 922df5fac..f0cba0168 100644 --- a/maxscale-system-test/mxs1932_hidden_cnf.cpp +++ b/maxscale-system-test/mxs1932_hidden_cnf.cpp @@ -35,7 +35,7 @@ int main(int argc, char** argv) test.maxscales->access_homedir[0]); // Make sure the hidden configuration is not read and that MaxScale starts up - test.assert(test.maxscales->restart_maxscale() == 0, "Starting MaxScale should succeed"); + test.expect(test.maxscales->restart_maxscale() == 0, "Starting MaxScale should succeed"); test.maxscales->ssh_node_f(0, true, "rm -r /etc/maxscale.cnf.d/"); remove("hidden.cnf"); diff --git a/maxscale-system-test/mxs1958_insert_priv.cpp b/maxscale-system-test/mxs1958_insert_priv.cpp index 44d5a36eb..a4348ce98 100644 --- a/maxscale-system-test/mxs1958_insert_priv.cpp +++ b/maxscale-system-test/mxs1958_insert_priv.cpp @@ -13,7 +13,7 @@ int main(int argc, char** argv) test.repl->sync_slaves(); MYSQL* conn = open_conn(test.maxscales->rwsplit_port[0], test.maxscales->IP[0], "insert_only", "insert_only", false); - test.assert(mysql_errno(conn) == 0, "User without SELECT privileges should be allowed to connect"); + test.expect(mysql_errno(conn) == 0, "User without SELECT privileges should be allowed to connect"); mysql_close(conn); execute_query(test.repl->nodes[0], "DROP USER 'insert_only'@'%%'"); diff --git a/maxscale-system-test/mxs1961_standalone_rejoin.cpp b/maxscale-system-test/mxs1961_standalone_rejoin.cpp index 70b05779f..a5d08cf0a 100644 --- a/maxscale-system-test/mxs1961_standalone_rejoin.cpp +++ b/maxscale-system-test/mxs1961_standalone_rejoin.cpp @@ -45,19 +45,19 @@ int main(int argc, char *argv[]) auto slave = [&](const char* name) { static StringSet slave{"Slave", "Running"}; - test.assert(status(name) == slave, "'%s' should be a slave", name); + test.expect(status(name) == slave, "'%s' should be a slave", name); }; auto master = [&](const char* name) { static StringSet master{"Master", "Running"}; - test.assert(status(name) == master, "'%s' should be the master", name); + test.expect(status(name) == master, "'%s' should be the master", name); }; auto down = [&](const char* name) { static StringSet down{"Down"}; - test.assert(status(name) == down, "'%s' should be down", name); + test.expect(status(name) == down, "'%s' should be down", name); }; auto block = [&](int node) diff --git a/maxscale-system-test/mxs872_roles.cpp b/maxscale-system-test/mxs872_roles.cpp index 1189f7f9b..e54facd4f 100644 --- a/maxscale-system-test/mxs872_roles.cpp +++ b/maxscale-system-test/mxs872_roles.cpp @@ -36,15 +36,15 @@ int main(int argc, char** argv) test.tprintf("Connect with a user that has a default role"); MYSQL* conn = open_conn_db(test.maxscales->rwsplit_port[0], test.maxscales->IP[0], "my_db", "test", "test"); - test.assert(mysql_errno(conn) == 0, "Connection failed: %s", mysql_error(conn)); + test.expect(mysql_errno(conn) == 0, "Connection failed: %s", mysql_error(conn)); char value[100] {}; find_field(conn, "SELECT CURRENT_ROLE() AS role", "role", value); - test.assert(strcmp(value, "dba") == 0, "Current role should be 'dba' but is: %s", value); + test.expect(strcmp(value, "dba") == 0, "Current role should be 'dba' but is: %s", value); mysql_close(conn); test.tprintf("Connect with a user that doesn't have a default role, expect failure"); conn = open_conn_db(test.maxscales->rwsplit_port[0], test.maxscales->IP[0], "my_db", "test2", "test2"); - test.assert(mysql_errno(conn) != 0, "Connection should fail"); + test.expect(mysql_errno(conn) != 0, "Connection should fail"); mysql_close(conn); // Cleanup diff --git a/maxscale-system-test/mysqlmon_detect_standalone_master.cpp b/maxscale-system-test/mysqlmon_detect_standalone_master.cpp index 1f370214c..eb9073511 100644 --- a/maxscale-system-test/mysqlmon_detect_standalone_master.cpp +++ b/maxscale-system-test/mysqlmon_detect_standalone_master.cpp @@ -68,7 +68,7 @@ void restore_servers(TestConnections& test, bool events_added) "maxadmin call command mariadbmon switchover MySQL-Monitor server1 server4", true, &dummy); test.maxscales->wait_for_monitor(); int master_id = get_master_server_id(test); - test.assert(master_id == 1, "Switchover failed to set server1 as master."); + test.expect(master_id == 1, "Switchover failed to set server1 as master."); } else { @@ -112,7 +112,7 @@ int main(int argc, char *argv[]) get_output(test); int master_id = get_master_server_id(test); - test.assert(master_id == 4, "Server 4 should be master, but master is server %d.", master_id); + test.expect(master_id == 4, "Server 4 should be master, but master is server %d.", master_id); if (test.global_result != 0) { @@ -150,7 +150,7 @@ int main(int argc, char *argv[]) test.repl->connect(); int real_id = test.repl->get_server_id(3); - test.assert(master_id == real_id, "@@server_id is different: %d != %d", master_id, real_id); + test.expect(master_id == real_id, "@@server_id is different: %d != %d", master_id, real_id); print_gtids(test); test.maxscales->close_maxscale_connections(0); diff --git a/maxscale-system-test/mysqlmon_external_master.cpp b/maxscale-system-test/mysqlmon_external_master.cpp index 7a9073c54..054686e80 100644 --- a/maxscale-system-test/mysqlmon_external_master.cpp +++ b/maxscale-system-test/mysqlmon_external_master.cpp @@ -18,7 +18,7 @@ const StringSet down = {DOWN}; void check_status(TestConnections& test, const char* server, const StringSet& expected, const char* message) { StringSet state = test.get_server_status(server); - test.assert(state == expected, "%s: %s", message, dump_status(state, expected).c_str()); + test.expect(state == expected, "%s: %s", message, dump_status(state, expected).c_str()); } static bool is_running = true; diff --git a/maxscale-system-test/mysqlmon_failover_no_slaves.cpp b/maxscale-system-test/mysqlmon_failover_no_slaves.cpp index 7fffa7bc7..4faa0cf8e 100644 --- a/maxscale-system-test/mysqlmon_failover_no_slaves.cpp +++ b/maxscale-system-test/mysqlmon_failover_no_slaves.cpp @@ -53,7 +53,7 @@ int main(int argc, char** argv) test.maxscales->wait_for_monitor(); get_output(test); int master_id = get_master_server_id(test); - test.assert(master_id == -1, "Master was promoted even when no slave was eligible."); + test.expect(master_id == -1, "Master was promoted even when no slave was eligible."); test.repl->unblock_node(0); diff --git a/maxscale-system-test/mysqlmon_failover_stress.cpp b/maxscale-system-test/mysqlmon_failover_stress.cpp index 894049bab..e94537e47 100755 --- a/maxscale-system-test/mysqlmon_failover_stress.cpp +++ b/maxscale-system-test/mysqlmon_failover_stress.cpp @@ -462,17 +462,17 @@ bool check_server_status(TestConnections& test, int id) else { cout << result; - test.assert(false, "Merely 'Running' node did not error in expected way."); + test.expect(false, "Merely 'Running' node did not error in expected way."); } } else { - test.assert(false, "Could not execute \"SHOW SLAVE STATUS\""); + test.expect(false, "Could not execute \"SHOW SLAVE STATUS\""); } } else { - test.assert(false, "Unexpected server state for %s.", server.c_str()); + test.expect(false, "Unexpected server state for %s.", server.c_str()); } cout << endl; @@ -497,7 +497,7 @@ void check_server_statuses(TestConnections& test) } else if (masters != 1) { - test.assert(!true, "Unexpected number of masters: %d", masters); + test.expect(!true, "Unexpected number of masters: %d", masters); } } @@ -552,7 +552,7 @@ void run(TestConnections& test) } else { - test.assert(false, "Unexpected master id: %d"); + test.expect(false, "Unexpected master id: %d"); } } diff --git a/maxscale-system-test/mysqlmon_rejoin_bad.cpp b/maxscale-system-test/mysqlmon_rejoin_bad.cpp index b2c3dce9d..c7216d473 100644 --- a/maxscale-system-test/mysqlmon_rejoin_bad.cpp +++ b/maxscale-system-test/mysqlmon_rejoin_bad.cpp @@ -47,7 +47,7 @@ int main(int argc, char** argv) // Mess with the slaves to fix situation such that only one slave can be rejoined. Stop maxscale. if (test.stop_maxscale(0)) { - test.assert(false, "Could not stop MaxScale."); + test.expect(false, "Could not stop MaxScale."); return test.global_result; } @@ -66,7 +66,7 @@ int main(int argc, char** argv) mysql_query(nodes[i], RESET_SLAVE) != 0 || mysql_query(nodes[i], READ_ONLY_OFF) != 0) { - test.assert(false, "Could not stop slave connections and/or disable read_only for node %d.", i); + test.expect(false, "Could not stop slave connections and/or disable read_only for node %d.", i); return test.global_result; } } @@ -86,7 +86,7 @@ int main(int argc, char** argv) } print_gtids(test); bool gtids_ok = (gtid_begin == gtid_node2 && gtid_node2 < gtid_node3); - test.assert(gtids_ok, "Gtid:s have not advanced correctly."); + test.expect(gtids_ok, "Gtid:s have not advanced correctly."); if (!gtids_ok) { return test.global_result; @@ -95,7 +95,7 @@ int main(int argc, char** argv) test.tprintf(LINE); if (test.start_maxscale(0)) { - test.assert(false, "Could not start MaxScale."); + test.expect(false, "Could not start MaxScale."); return test.global_result; } test.maxscales->wait_for_monitor(); @@ -105,8 +105,8 @@ int main(int argc, char** argv) StringSet node3_states = test.get_server_status("server4"); bool states_n2_ok = (node2_states.find("Slave") != node2_states.end()); bool states_n3_ok = (node3_states.find("Slave") == node3_states.end()); - test.assert(states_n2_ok, "Node 2 has not rejoined when it should have."); - test.assert(states_n3_ok, "Node 3 rejoined when it shouldn't have."); + test.expect(states_n2_ok, "Node 2 has not rejoined when it should have."); + test.expect(states_n3_ok, "Node 3 rejoined when it shouldn't have."); if (!states_n2_ok || !states_n3_ok) { return test.global_result; @@ -122,11 +122,11 @@ int main(int argc, char** argv) test.maxscales->wait_for_monitor(); get_output(test); int master_id = get_master_server_id(test); - test.assert(master_id == 4, "Server 4 should be the cluster master."); + test.expect(master_id == 4, "Server 4 should be the cluster master."); StringSet node0_states = test.get_server_status("server1"); bool states_n0_ok = (node0_states.find("Slave") != node0_states.end() && node0_states.find("Relay Master") == node0_states.end()); - test.assert(states_n0_ok, "Server 1 is not a slave when it should be."); + test.expect(states_n0_ok, "Server 1 is not a slave when it should be."); if (states_n0_ok) { int ec; @@ -134,7 +134,7 @@ int main(int argc, char** argv) "maxadmin call command mysqlmon switchover MySQL-Monitor server1 server4" , true, &ec); test.maxscales->wait_for_monitor(); master_id = get_master_server_id(test); - test.assert(master_id == 1, "Server 1 should be the cluster master."); + test.expect(master_id == 1, "Server 1 should be the cluster master."); get_output(test); } diff --git a/maxscale-system-test/mysqlmon_rejoin_bad2.cpp b/maxscale-system-test/mysqlmon_rejoin_bad2.cpp index aa1f6cd8c..c21fb4499 100644 --- a/maxscale-system-test/mysqlmon_rejoin_bad2.cpp +++ b/maxscale-system-test/mysqlmon_rejoin_bad2.cpp @@ -92,7 +92,7 @@ int main(int argc, char** argv) get_output(test); int master_id_new = get_master_server_id(test); cout << "Master server id is " << master_id_new << endl; - test.assert(master_id_new > 0 && master_id_new != master_id_old, + test.expect(master_id_new > 0 && master_id_new != master_id_old, "Failover did not promote a new master."); if (test.global_result != 0) { @@ -102,7 +102,7 @@ int main(int argc, char** argv) // Stop maxscale to prevent an unintended rejoin. if (test.stop_maxscale(0)) { - test.assert(false, "Could not stop MaxScale."); + test.expect(false, "Could not stop MaxScale."); return test.global_result; } // Restart old master. Then add some events to it. @@ -115,7 +115,7 @@ int main(int argc, char** argv) // Restart maxscale. Should not rejoin old master. if (test.start_maxscale(0)) { - test.assert(false, "Could not start MaxScale."); + test.expect(false, "Could not start MaxScale."); return test.global_result; } test.maxscales->wait_for_monitor(); diff --git a/maxscale-system-test/mysqlmon_rejoin_good.cpp b/maxscale-system-test/mysqlmon_rejoin_good.cpp index e51495312..2ddfade5f 100644 --- a/maxscale-system-test/mysqlmon_rejoin_good.cpp +++ b/maxscale-system-test/mysqlmon_rejoin_good.cpp @@ -47,7 +47,7 @@ int main(int argc, char** argv) test.tprintf(LINE); test.tprintf(PRINT_ID, master_id); const bool failover_ok = (master_id > 0 && master_id != old_master_id); - test.assert(failover_ok, "Master did not change or no master detected."); + test.expect(failover_ok, "Master did not change or no master detected."); string gtid_final; if (failover_ok) { @@ -76,7 +76,7 @@ int main(int argc, char** argv) test.tprintf(LINE); print_gtids(test); test.tprintf(LINE); - test.assert(gtid_final == gtid_old_master, "Old master did not successfully rejoin the cluster."); + test.expect(gtid_final == gtid_old_master, "Old master did not successfully rejoin the cluster."); // Switch master back to server1 so last check is faster int ec; test.maxscales->ssh_node_output(0, "maxadmin call command mysqlmon switchover " @@ -84,7 +84,7 @@ int main(int argc, char** argv) test.maxscales->wait_for_monitor(); // Wait for monitor to update status get_output(test); master_id = get_master_server_id(test); - test.assert(master_id == old_master_id, "Switchover back to server1 failed."); + test.expect(master_id == old_master_id, "Switchover back to server1 failed."); } else { diff --git a/maxscale-system-test/mysqlmon_rejoin_manual.cpp b/maxscale-system-test/mysqlmon_rejoin_manual.cpp index 226df7d10..ec07121c3 100644 --- a/maxscale-system-test/mysqlmon_rejoin_manual.cpp +++ b/maxscale-system-test/mysqlmon_rejoin_manual.cpp @@ -51,7 +51,7 @@ int main(int argc, char** argv) int master_id = get_master_server_id(test); cout << "Master server id is " << master_id << endl; const bool failover_ok = (master_id > 0 && master_id != old_master_id); - test.assert(failover_ok, "Master did not change or no master detected."); + test.expect(failover_ok, "Master did not change or no master detected."); string gtid_final; if (failover_ok) { @@ -82,7 +82,7 @@ int main(int argc, char** argv) cout << LINE << "\n"; print_gtids(test); cout << LINE << "\n"; - test.assert(gtid_final == gtid_old_master, "Old master did not successfully rejoin the cluster (%s != %s).", gtid_final.c_str(), gtid_old_master.c_str()); + test.expect(gtid_final == gtid_old_master, "Old master did not successfully rejoin the cluster (%s != %s).", gtid_final.c_str(), gtid_old_master.c_str()); // Switch master back to server1 so last check is faster int ec; test.maxscales->ssh_node_output(0, "maxadmin call command mysqlmon switchover " @@ -90,7 +90,7 @@ int main(int argc, char** argv) test.maxscales->wait_for_monitor(); // Wait for monitor to update status get_output(test); master_id = get_master_server_id(test); - test.assert(master_id == old_master_id, "Switchover back to server1 failed."); + test.expect(master_id == old_master_id, "Switchover back to server1 failed."); } else { diff --git a/maxscale-system-test/mysqlmon_rejoin_manual2.cpp b/maxscale-system-test/mysqlmon_rejoin_manual2.cpp index adc4e53ec..9facefe74 100644 --- a/maxscale-system-test/mysqlmon_rejoin_manual2.cpp +++ b/maxscale-system-test/mysqlmon_rejoin_manual2.cpp @@ -62,7 +62,7 @@ int main(int argc, char** argv) mysql_query(nodes[i], RESET_SLAVE) != 0 || mysql_query(nodes[i], READ_ONLY_OFF) != 0) { - test.assert(false, "Could not stop slave connections and/or disable read_only for node %d.", i); + test.expect(false, "Could not stop slave connections and/or disable read_only for node %d.", i); return test.global_result; } } @@ -82,7 +82,7 @@ int main(int argc, char** argv) } print_gtids(test); bool gtids_ok = (gtid_begin == gtid_node2 && gtid_node2 < gtid_node3); - test.assert(gtids_ok, "Gtid:s have not advanced correctly."); + test.expect(gtids_ok, "Gtid:s have not advanced correctly."); if (!gtids_ok) { return test.global_result; @@ -101,8 +101,8 @@ int main(int argc, char** argv) StringSet node3_states = test.get_server_status("server4"); bool states_n2_ok = (node2_states.find("Slave") != node2_states.end()); bool states_n3_ok = (node3_states.find("Slave") == node3_states.end()); - test.assert(states_n2_ok, "Node 2 has not rejoined when it should have."); - test.assert(states_n3_ok, "Node 3 rejoined when it shouldn't have."); + test.expect(states_n2_ok, "Node 2 has not rejoined when it should have."); + test.expect(states_n3_ok, "Node 3 rejoined when it shouldn't have."); if (!states_n2_ok || !states_n3_ok) { return test.global_result; @@ -122,11 +122,11 @@ int main(int argc, char** argv) test.maxscales->wait_for_monitor(); get_output(test); int master_id = get_master_server_id(test); - test.assert(master_id == 4, "Server 4 should be the cluster master."); + test.expect(master_id == 4, "Server 4 should be the cluster master."); StringSet node0_states = test.get_server_status("server1"); bool states_n0_ok = (node0_states.find("Slave") != node0_states.end() && node0_states.find("Relay Master") == node0_states.end()); - test.assert(states_n0_ok, "Server 1 is not a slave when it should be."); + test.expect(states_n0_ok, "Server 1 is not a slave when it should be."); if (states_n0_ok) { int ec; @@ -134,7 +134,7 @@ int main(int argc, char** argv) "maxadmin call command mysqlmon switchover MySQL-Monitor server1 server4" , true, &ec); test.maxscales->wait_for_monitor(); master_id = get_master_server_id(test); - test.assert(master_id == 1, "Server 1 should be the cluster master."); + test.expect(master_id == 1, "Server 1 should be the cluster master."); get_output(test); } diff --git a/maxscale-system-test/mysqlmon_switchover.cpp b/maxscale-system-test/mysqlmon_switchover.cpp index e776854b2..8b62637be 100644 --- a/maxscale-system-test/mysqlmon_switchover.cpp +++ b/maxscale-system-test/mysqlmon_switchover.cpp @@ -96,7 +96,7 @@ void expect(TestConnections& test, const char* zServer, const StringSet& expecte if (found != expected) { - test.assert(false, "Found states are not the same as the expected ones."); + test.expect(false, "Found states are not the same as the expected ones."); ++test.global_result; } diff --git a/maxscale-system-test/mysqlmon_switchover_stress.cpp b/maxscale-system-test/mysqlmon_switchover_stress.cpp index ab7df2421..112225f19 100644 --- a/maxscale-system-test/mysqlmon_switchover_stress.cpp +++ b/maxscale-system-test/mysqlmon_switchover_stress.cpp @@ -450,18 +450,18 @@ bool check_server_status(TestConnections& test, int id) if (find_field(pConn, "SHOW SLAVE STATUS", "Last_IO_Error", result) == 0) { cout << result << endl; - test.assert(false, "Server is neither slave, nor master."); + test.expect(false, "Server is neither slave, nor master."); } else { cout << "?" << endl; - test.assert(false, "Could not execute \"SHOW SLAVE STATUS\""); + test.expect(false, "Could not execute \"SHOW SLAVE STATUS\""); } } else { cout << "?" << endl; - test.assert(false, "Unexpected server state for %s.", server.c_str()); + test.expect(false, "Unexpected server state for %s.", server.c_str()); } return is_master; @@ -476,7 +476,7 @@ void check_server_statuses(TestConnections& test) masters += check_server_status(test, 3); masters += check_server_status(test, 4); - test.assert(masters == 1, "Unpexpected number of masters: %d", masters); + test.expect(masters == 1, "Unpexpected number of masters: %d", masters); } int get_next_master_id(TestConnections& test, int current_id) @@ -600,18 +600,18 @@ void run(TestConnections& test) if (master_id < 0) { - test.assert(false, "No master available after switchover."); + test.expect(false, "No master available after switchover."); } else if (master_id != current_master_id) { - test.assert(false, + test.expect(false, "Master should have been server%d, but it was server%d.", current_master_id, master_id); } } else { - test.assert(false, + test.expect(false, "Could not find any slave to switch to."); } } diff --git a/maxscale-system-test/sequence.cpp b/maxscale-system-test/sequence.cpp index 12953adb2..a5d65817b 100644 --- a/maxscale-system-test/sequence.cpp +++ b/maxscale-system-test/sequence.cpp @@ -25,7 +25,7 @@ int main(int argc, char** argv) for (auto a : statements) { - test.assert(execute_query_check_one(test.maxscales->conn_rwsplit[0], a.first, a.second) == 0, + test.expect(execute_query_check_one(test.maxscales->conn_rwsplit[0], a.first, a.second) == 0, "Expected '%s' for query: %s", a.second, a.first); } @@ -39,7 +39,7 @@ int main(int argc, char** argv) for (auto a : oracle_statements) { - test.assert(execute_query_check_one(test.maxscales->conn_rwsplit[0], a.first, a.second) == 0, + test.expect(execute_query_check_one(test.maxscales->conn_rwsplit[0], a.first, a.second) == 0, "Expected '%s' for query: %s", a.second, a.first); } diff --git a/maxscale-system-test/testconnections.cpp b/maxscale-system-test/testconnections.cpp index 31cf08291..7767b7c1e 100644 --- a/maxscale-system-test/testconnections.cpp +++ b/maxscale-system-test/testconnections.cpp @@ -401,7 +401,7 @@ void TestConnections::add_result(bool result, const char *format, ...) } } -void TestConnections::assert(bool result, const char *format, ...) +void TestConnections::expect(bool result, const char *format, ...) { if (!result) { @@ -811,7 +811,7 @@ int TestConnections::copy_maxscale_logs(double timestamp) const char* command = "ls /tmp/core* && exit 42"; int rc = maxscales->ssh_node_f(i, true, command); - assert(rc != 42, "Test should not generate core files"); + expect(rc != 42, "Test should not generate core files"); } return 0; } diff --git a/maxscale-system-test/testconnections.h b/maxscale-system-test/testconnections.h index 324f8a54f..fc217a934 100644 --- a/maxscale-system-test/testconnections.h +++ b/maxscale-system-test/testconnections.h @@ -252,7 +252,7 @@ public: void add_result(bool result, const char *format, ...); /** Same as add_result() but inverted */ - void assert(bool result, const char *format, ...); + void expect(bool result, const char *format, ...); /** * @brief ReadEnv Reads all Maxscale and Master/Slave and Galera setups info from environmental variables