Add format attribute to test functions, fix resulting errors
Fixes mysqlmon_failover_stress.
This commit is contained in:
parent
e1f2b81734
commit
d65d815b99
@ -115,7 +115,7 @@ void test2(TestConnections& test)
|
||||
test.add_result(strcmp(buffer1, buffer2) == 0, "Expected results to differ");
|
||||
test.add_result(strcmp(buffer2, server_id) != 0,
|
||||
"Expected prepare 2 to go to the master (%s) but it's %s",
|
||||
server_id[0], buffer2);
|
||||
server_id, buffer2);
|
||||
}
|
||||
|
||||
void test3(TestConnections& test)
|
||||
@ -168,7 +168,7 @@ void test3(TestConnections& test)
|
||||
sprintf(server_id, "%d", test.repl->get_server_id(0));
|
||||
test.add_result(strcmp(buffer, server_id) != 0,
|
||||
"Expected the execute inside a transaction to go to the master (%s) but it's %s",
|
||||
server_id[0], buffer);
|
||||
server_id, buffer);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
|
@ -175,7 +175,7 @@ int check_longblob_data(TestConnections* Test, MYSQL * conn, unsigned long chunk
|
||||
{
|
||||
if ((int)data[y] != y)
|
||||
{
|
||||
Test->add_result(1, "expected %d, got %d", data[y], y);
|
||||
Test->add_result(1, "expected %lu, got %d", data[y], y);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
Test->set_timeout(15);
|
||||
Test->add_result(mysql_change_user(Test->maxscales->conn_rwsplit[0], "user", "pass2", (char *) "test"),
|
||||
"change_user failed! %", mysql_error(Test->maxscales->conn_rwsplit[0]));
|
||||
"change_user failed! %s", mysql_error(Test->maxscales->conn_rwsplit[0]));
|
||||
Test->add_result(mysql_change_user(Test->maxscales->conn_rwsplit[0], Test->maxscales->user_name, Test->maxscales->password,
|
||||
(char *) "test"), "change_user failed! %s", mysql_error(Test->maxscales->conn_rwsplit[0]));
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ int main(int argc, char** argv)
|
||||
std::accumulate(errors.begin(), errors.end(), std::string(),
|
||||
[](const std::string &a, const std::string &b) {
|
||||
return a + b + " ";
|
||||
}));
|
||||
}).c_str());
|
||||
|
||||
test.tprintf("Dropping databases...");
|
||||
for (auto db : db_list)
|
||||
|
@ -33,7 +33,8 @@ int main(int argc, char** argv)
|
||||
test.maxscales->connect();
|
||||
|
||||
MYSQL_STMT* stmt = mysql_stmt_init(test.maxscales->conn_rwsplit[0]);
|
||||
test.expect(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. Error: %s",
|
||||
mysql_stmt_error(stmt));
|
||||
mysql_stmt_close(stmt);
|
||||
|
||||
|
@ -59,7 +59,7 @@ void do_query(TestConnections *test, bool should_fail)
|
||||
"Query was successful when failure was expected." :
|
||||
"Query failed when success was expected.";
|
||||
|
||||
test->add_result(failed == should_fail, msg);
|
||||
test->add_result(failed == should_fail, "%s", msg);
|
||||
test->maxscales->close_maxscale_connections(0);
|
||||
|
||||
test->stop_timeout();
|
||||
|
@ -38,7 +38,7 @@ void do_query(TestConnections *test, bool should_fail)
|
||||
"Query was successful when failure was expected." :
|
||||
"Query failed when success was expected.";
|
||||
|
||||
test->add_result(failed == should_fail, msg);
|
||||
test->add_result(failed == should_fail, "%s", msg);
|
||||
test->maxscales->close_maxscale_connections(0);
|
||||
|
||||
test->stop_timeout();
|
||||
|
@ -552,7 +552,7 @@ void run(TestConnections& test)
|
||||
}
|
||||
else
|
||||
{
|
||||
test.expect(false, "Unexpected master id: %d");
|
||||
test.expect(false, "Unexpected master id: %d", master_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,15 +75,15 @@ void *query_thread1( void *ptr )
|
||||
{
|
||||
MYSQL *conn1 = data->Test->maxscales->open_rwsplit_connection(0);
|
||||
data->Test->add_result(mysql_errno(conn1),
|
||||
"Error opening RWsplit conn, thread num is %d, iteration %d, error is: %s\n",
|
||||
"Error opening RWsplit conn, thread num is %d, iteration %li, error is: %s\n",
|
||||
data->thread_id, data->i, mysql_error(conn1));
|
||||
MYSQL *conn2 = data->Test->maxscales->open_readconn_master_connection(0);
|
||||
data->Test->add_result(mysql_errno(conn2),
|
||||
"Error opening ReadConn master conn, thread num is %d, iteration %d, error is: %s\n", data->thread_id,
|
||||
"Error opening ReadConn master conn, thread num is %d, iteration %li, error is: %s\n", data->thread_id,
|
||||
data->i, mysql_error(conn2));
|
||||
MYSQL *conn3 = data->Test->maxscales->open_readconn_slave_connection(0);
|
||||
data->Test->add_result(mysql_errno(conn3),
|
||||
"Error opening ReadConn master conn, thread num is %d, iteration %d, error is: %s\n", data->thread_id,
|
||||
"Error opening ReadConn master conn, thread num is %d, iteration %li, error is: %s\n", data->thread_id,
|
||||
data->i, mysql_error(conn3));
|
||||
// USE test here is a hack to prevent Maxscale from failure; should be removed when fixed
|
||||
if (conn1 != NULL)
|
||||
|
@ -252,10 +252,10 @@ public:
|
||||
* @param result 0 if step PASSED
|
||||
* @param format ... message to pring if result is not 0
|
||||
*/
|
||||
void add_result(bool result, const char *format, ...);
|
||||
void add_result(bool result, const char *format, ...) __attribute__((format(printf, 3, 4)));
|
||||
|
||||
/** Same as add_result() but inverted */
|
||||
void expect(bool result, const char *format, ...);
|
||||
void expect(bool result, const char *format, ...) __attribute__((format(printf, 3, 4)));
|
||||
|
||||
/**
|
||||
* @brief ReadEnv Reads all Maxscale and Master/Slave and Galera setups info from environmental variables
|
||||
|
Loading…
x
Reference in New Issue
Block a user