From 9be78df776b4996a00d8d4535d233252fe559ecf Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Wed, 25 Nov 2020 08:17:10 +0200 Subject: [PATCH] MXS-3306 Make binary_ps test work with more servers than 4 When doing the match, the test only checked slaves 1 - 3. If the test is run after a heavy test there will also be slaves 4 - 14. --- system-test/binary_ps.cpp | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/system-test/binary_ps.cpp b/system-test/binary_ps.cpp index 757a987ac..6f5146c5a 100644 --- a/system-test/binary_ps.cpp +++ b/system-test/binary_ps.cpp @@ -54,14 +54,25 @@ int main(int argc, char** argv) test.add_result(mysql_stmt_execute(stmt), "Failed to execute"); test.add_result(mysql_stmt_bind_result(stmt, bind), "Failed to bind result"); test.add_result(mysql_stmt_fetch(stmt), "Failed to fetch result"); - test.add_result(strcmp(buffer, - server_id[1]) && strcmp(buffer, server_id[2]) && strcmp(buffer, server_id[3]), - "Expected one of the slave server IDs (%s, %s or %s), not '%s'", - server_id[1], - server_id[2], - server_id[3], - buffer); + std::string server_ids; + bool found = false; + for (int i = 1; i < test.repl->N; ++i) + { + if (strcmp(buffer, server_id[i]) == 0) + { + found = true; + } + if (!server_ids.empty()) + { + server_ids += ", "; + } + + server_ids += server_id[i]; + } + + test.expect(found, "Expected one of the slave server IDs (%s), not '%s'", + server_ids.c_str(), buffer); mysql_stmt_close(stmt);