From e142f7e24e749cf711aa7c7b90fbe6b356a47c15 Mon Sep 17 00:00:00 2001 From: Rene Cannao Date: Mon, 9 Mar 2026 02:10:56 +0000 Subject: [PATCH] Fix ProxySQL environment configuration in mysql-init_connect-2-t.cpp - Clear existing query rules to prevent interference. - Explicitly route testuser SELECT queries to hostgroup 1. --- test/tap/tests/mysql-init_connect-2-t.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) mode change 100644 => 100755 test/tap/tests/mysql-init_connect-2-t.cpp diff --git a/test/tap/tests/mysql-init_connect-2-t.cpp b/test/tap/tests/mysql-init_connect-2-t.cpp old mode 100644 new mode 100755 index 7f0a6b5cd..07dc87c9e --- a/test/tap/tests/mysql-init_connect-2-t.cpp +++ b/test/tap/tests/mysql-init_connect-2-t.cpp @@ -46,6 +46,15 @@ int main(int argc, char** argv) { if (!mysql_real_connect(mysqladmin, cl.host, cl.admin_username, cl.admin_password, NULL, cl.admin_port, NULL, 0)) { fprintf(stderr, "File %s, line %d, Error: %s\n", __FILE__, __LINE__, mysql_error(mysqladmin)); return exit_status(); + } else { + diag("Configuring ProxySQL for the test requirements..."); + // Clear existing rules to avoid interference + MYSQL_QUERY(mysqladmin, "DELETE FROM mysql_query_rules"); + + // Create a rule to send all SELECTs from testuser to hostgroup 1 + MYSQL_QUERY(mysqladmin, "INSERT INTO mysql_query_rules(rule_id, active, username, match_digest, destination_hostgroup, apply) VALUES (1, 1, 'testuser', '^SELECT', 1, 1)"); + + MYSQL_QUERY(mysqladmin, "LOAD MYSQL QUERY RULES TO RUNTIME"); } MYSQL* mysql = mysql_init(NULL);