Merge branch '2.2' into develop
This commit is contained in:
commit
8c561c6e55
@ -122,8 +122,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)
|
||||
@ -177,8 +176,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)
|
||||
|
@ -193,7 +193,7 @@ int check_longblob_data(TestConnections* Test,
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -93,15 +93,10 @@ int main(int argc, char* argv[])
|
||||
for (int i = 0; i < iterations; i++)
|
||||
{
|
||||
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]));
|
||||
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]));
|
||||
Test->add_result(mysql_change_user(Test->maxscales->conn_rwsplit[0], "user", "pass2", (char *) "test"),
|
||||
"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]));
|
||||
}
|
||||
|
||||
Test->tprintf("Waiting for all threads to finish");
|
||||
|
@ -88,7 +88,7 @@ void select(TestConnections& test, int* pValue)
|
||||
}
|
||||
while (mysql_next_result(pMysql) == 0);
|
||||
|
||||
test.expect(nRows == 1, "Unexpected number of rows: %u", nRows);
|
||||
test.expect(nRows == 1, "Unexpected number of rows: %lu", nRows);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -97,7 +97,7 @@ void select(TestConnections& test, Column column, int* pValue)
|
||||
}
|
||||
while (mysql_next_result(pMysql) == 0);
|
||||
|
||||
test.expect(nRows == 1, "Unexpected number of rows: %u", nRows);
|
||||
test.expect(nRows == 1, "Unexpected number of rows: %lu", nRows);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -43,7 +43,7 @@ int main(int argc, char** argv)
|
||||
|
||||
auto ok = [&test, &query](string q, int t = 0) {
|
||||
test.expect(query(q, t),
|
||||
"Query '%' should work: %s",
|
||||
"Query '%s' should work: %s",
|
||||
q.c_str(),
|
||||
mysql_error(test.maxscales->conn_rwsplit[0]));
|
||||
};
|
||||
|
@ -132,7 +132,7 @@ void gauge_raw_speed(TestConnections& test)
|
||||
std::ostringstream os;
|
||||
os << "The raw speed is too slow, " << rs.qps
|
||||
<< "qps, compared to max_qps = " << max_qps << "qps for accurate testing.";
|
||||
test.add_result(1, os.str().c_str());
|
||||
test.add_result(1, "%s", os.str().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@ -157,7 +157,7 @@ void verify_throttling_performace(TestConnections& test)
|
||||
std::ostringstream os;
|
||||
os << "Throttled speed 1: " << rs1.qps << " or 2: " << rs2.qps
|
||||
<< "differs from max_qps " << max_qps << " by more than 10%%";
|
||||
test.add_result(1, os.str().c_str());
|
||||
test.add_result(1, "%s", os.str().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@ -175,14 +175,14 @@ void verify_throttling_disconnect(TestConnections& test)
|
||||
std::ostringstream os;
|
||||
os << "Throttle filter did not disconnect rogue session.\n"
|
||||
<< rs.qps << "qps " << " duration " << rs.duration;
|
||||
test.add_result(1, os.str().c_str());
|
||||
test.add_result(1, "%s", os.str().c_str());
|
||||
}
|
||||
if (std::abs(rs.qps - max_qps) > 0.1 * max_qps)
|
||||
{
|
||||
std::ostringstream os;
|
||||
os << "Throttled speed " << rs.qps << " differs from max_qps " << max_qps
|
||||
<< " by more than 10%%";
|
||||
test.add_result(1, os.str().c_str());
|
||||
test.add_result(1, "%s", os.str().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@ -222,7 +222,7 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
catch (std::exception& ex)
|
||||
{
|
||||
test.add_result(1, ex.what());
|
||||
test.add_result(1, "%s", ex.what());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
@ -34,7 +34,7 @@ int main(int argc, char** argv)
|
||||
|
||||
MYSQL_STMT* stmt = mysql_stmt_init(test.maxscales->conn_rwsplit[0]);
|
||||
test.expect(mysql_stmt_prepare(stmt, sqlstr, strlen(sqlstr)) == 0,
|
||||
"Prepare should not fail",
|
||||
"Prepare should not fail. 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();
|
||||
|
@ -31,8 +31,8 @@ const time_t MONITOR_INTERVAL = 1;
|
||||
// been performed. Not very critical.
|
||||
const time_t FAILOVER_DURATION = 5;
|
||||
|
||||
// How long should we keep in running.
|
||||
const time_t TEST_DURATION = 90;
|
||||
// The test now runs only two failovers. Change for a longer time limit later.
|
||||
// TODO: add semisync to remove this limitation.
|
||||
|
||||
#define CMESSAGE(msg) \
|
||||
do { \
|
||||
@ -519,11 +519,9 @@ void run(TestConnections& test)
|
||||
cout << "Starting clients." << endl;
|
||||
Client::start(test.verbose, zHost, port, zUser, zPassword);
|
||||
|
||||
time_t start = time(NULL);
|
||||
|
||||
list_servers(test);
|
||||
|
||||
while (time(NULL) - start < TEST_DURATION)
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
test.set_timeout(20);
|
||||
test.maxscales->wait_for_monitor();
|
||||
@ -555,7 +553,7 @@ void run(TestConnections& test)
|
||||
}
|
||||
else
|
||||
{
|
||||
test.expect(false, "Unexpected master id: %d");
|
||||
test.expect(false, "Unexpected master id: %d", master_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -77,24 +77,16 @@ 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",
|
||||
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,
|
||||
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,
|
||||
data->i,
|
||||
mysql_error(conn3));
|
||||
"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 %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 %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)
|
||||
{
|
||||
|
@ -274,10 +274,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