From f2d135fa21f8d60fd28a296c0c9ab1f232bd0d5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Canna=C3=B2?= Date: Wed, 27 Jan 2021 15:51:22 +0100 Subject: [PATCH] Use of plan() in test_set_collation-t Also remove hardcoded values --- test/tap/tests/test_set_collation-t.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/test/tap/tests/test_set_collation-t.cpp b/test/tap/tests/test_set_collation-t.cpp index f40d6a967..5a6e353be 100644 --- a/test/tap/tests/test_set_collation-t.cpp +++ b/test/tap/tests/test_set_collation-t.cpp @@ -12,6 +12,9 @@ #include "command_line.h" #include "utils.h" +#define NUMBER_NEW_CONNECTIONS 2 +#define N_ITERATION_1 10 + /** * NOTE: This is a duplicate of 'proxysql_find_charset_collate' in 'MySQL_Variables.h'. Including * 'MySQL_Variables' is not a easy task due to its interdependeces with other ProxySQL modules. @@ -81,9 +84,14 @@ int main(int argc, char** argv) { return -1; } - int iterations = 10; std::vector conns {}; std::vector collations { "latin1_spanish_ci", "latin1_german2_ci", "latin1_danish_ci", "latin1_general_ci", "latin1_bin", "utf8_general_ci" }; + + int ntests = 0; + ntests += 1; // create all connections + ntests += (N_ITERATION_1 * collations.size() + NUMBER_NEW_CONNECTIONS) * 4; + plan(ntests); + int conns_res = create_proxysql_connections(cl, collations, conns); ok(conns_res == 0, "Successfully create all connections with different collations"); @@ -95,7 +103,7 @@ int main(int argc, char** argv) { * Force ProxySQL to create two new backend connections and simultaneously check that the * 'character_set%' and 'collation_connection' for them are correct. */ - for (int i = 0; i < 2; i++) { + for (int i = 0; i < NUMBER_NEW_CONNECTIONS; i++) { MYSQL* mysql = conns[i]; std::string collation = collations[i]; MYSQL_RES* proxy_res = nullptr; @@ -119,7 +127,7 @@ int main(int argc, char** argv) { std::string collation = collations[i]; MYSQL_RES* proxy_res = nullptr; - for (int j = 0; j < iterations; j++) { + for (int j = 0; j < N_ITERATION_1; j++) { MYSQL_QUERY( mysql, "SELECT lower(variable_name), variable_value FROM performance_schema.session_variables WHERE"