From 5d02ad5faf9bb1fdd4f1bbe043bb7245d3ac81ce Mon Sep 17 00:00:00 2001 From: Rene Cannao Date: Sun, 22 Mar 2026 18:34:33 +0000 Subject: [PATCH 01/22] Add basictests TAP group and sysbench to CI base image Part of the CI migration from jenkins-build-scripts to in-repo test/infra/ infrastructure (#5522). Adds: - test/tap/groups/basictests/ group (benchmark, chuser, failover tests) - sysbench to docker-base Dockerfile for benchmark tests Co-Authored-By: Claude Opus 4.6 (1M context) --- test/infra/docker-base/Dockerfile | 1 + test/tap/groups/basictests/env.sh | 21 +++++++++++++++++++++ test/tap/groups/basictests/infras.lst | 1 + 3 files changed, 23 insertions(+) create mode 100644 test/tap/groups/basictests/env.sh create mode 100644 test/tap/groups/basictests/infras.lst diff --git a/test/infra/docker-base/Dockerfile b/test/infra/docker-base/Dockerfile index cc77f62d65..eb7fb434a7 100755 --- a/test/infra/docker-base/Dockerfile +++ b/test/infra/docker-base/Dockerfile @@ -24,6 +24,7 @@ RUN apt-get update -qq && \ python3-yaml \ python3-packaging \ python3-structlog \ + sysbench \ php-cli \ php-mysql \ lcov \ diff --git a/test/tap/groups/basictests/env.sh b/test/tap/groups/basictests/env.sh new file mode 100644 index 0000000000..8dfb7538df --- /dev/null +++ b/test/tap/groups/basictests/env.sh @@ -0,0 +1,21 @@ +# Basictests Group Environment +# Runs Python-based functional tests: sysbench benchmark, change-user, failover. +# No ProxySQL cluster needed. + +export DEFAULT_MYSQL_INFRA="infra-mysql57" + +# No cluster +export SKIP_CLUSTER_START=1 + +# Test selection +export TEST_PY_BENCHMARK=1 +export TEST_PY_CHUSER=1 +export TEST_PY_FAILOVER=1 + +# Disable everything else +export TEST_PY_INTERNAL=0 +export TEST_PY_STATS=0 +export TEST_PY_TAP=0 +export TEST_PY_TAPINT=0 +export TEST_PY_WARMING=0 +export TEST_PY_READONLY=0 diff --git a/test/tap/groups/basictests/infras.lst b/test/tap/groups/basictests/infras.lst new file mode 100644 index 0000000000..51f5b953a5 --- /dev/null +++ b/test/tap/groups/basictests/infras.lst @@ -0,0 +1 @@ +infra-mysql57 From 75d958f29d470aff759a17ab731e5a9cbee98a4a Mon Sep 17 00:00:00 2001 From: Rene Cannao Date: Sun, 22 Mar 2026 19:32:10 +0000 Subject: [PATCH 02/22] Fix hardcoded /home/rene/proxysql paths in pre-proxysql.bash scripts Replace hardcoded absolute paths with dynamically derived REPO_ROOT so these scripts work on any machine (CI runners, other developers). Co-Authored-By: Claude Opus 4.6 (1M context) --- test/tap/groups/default/pre-proxysql.bash | 6 ++++-- test/tap/groups/legacy/pre-proxysql.bash | 5 +++-- test/tap/groups/mysql84-gr/pre-proxysql.bash | 9 +++++---- test/tap/groups/mysql84/pre-proxysql.bash | 13 +++++++------ test/tap/groups/mysql90-gr/pre-proxysql.bash | 9 +++++---- test/tap/groups/mysql90/pre-proxysql.bash | 9 +++++---- test/tap/groups/mysql91-gr/pre-proxysql.bash | 9 +++++---- test/tap/groups/mysql91/pre-proxysql.bash | 9 +++++---- test/tap/groups/mysql92-gr/pre-proxysql.bash | 9 +++++---- test/tap/groups/mysql92/pre-proxysql.bash | 9 +++++---- test/tap/groups/mysql93-gr/pre-proxysql.bash | 9 +++++---- test/tap/groups/mysql93/pre-proxysql.bash | 9 +++++---- 12 files changed, 59 insertions(+), 46 deletions(-) diff --git a/test/tap/groups/default/pre-proxysql.bash b/test/tap/groups/default/pre-proxysql.bash index d961fad9b6..d55551f698 100755 --- a/test/tap/groups/default/pre-proxysql.bash +++ b/test/tap/groups/default/pre-proxysql.bash @@ -8,8 +8,10 @@ set -o pipefail # Start ProxySQL Cluster if available -/home/rene/proxysql/test/infra/control/cluster_start.bash -/home/rene/proxysql/test/infra/control/cluster_init.bash +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +REPO_ROOT="$(cd "${SCRIPT_DIR}/../../.." && pwd)" +"${REPO_ROOT}/test/infra/control/cluster_start.bash" +"${REPO_ROOT}/test/infra/control/cluster_init.bash" # wait for cluster to stabilize sleep 10 diff --git a/test/tap/groups/legacy/pre-proxysql.bash b/test/tap/groups/legacy/pre-proxysql.bash index 84e5c186c1..f7daac7cc6 100755 --- a/test/tap/groups/legacy/pre-proxysql.bash +++ b/test/tap/groups/legacy/pre-proxysql.bash @@ -1,13 +1,14 @@ #!/usr/bin/env bash set -e set -o pipefail +REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)" # # Start ProxySQL Cluster if available # inherits env from tester script # -/home/rene/proxysql/test/infra/control/cluster_start.bash -/home/rene/proxysql/test/infra/control/cluster_init.bash +${REPO_ROOT}/test/infra/control/cluster_start.bash +${REPO_ROOT}/test/infra/control/cluster_init.bash # wait for cluster to stabilize sleep 10 diff --git a/test/tap/groups/mysql84-gr/pre-proxysql.bash b/test/tap/groups/mysql84-gr/pre-proxysql.bash index c1e7e33c11..4fd4c96d24 100755 --- a/test/tap/groups/mysql84-gr/pre-proxysql.bash +++ b/test/tap/groups/mysql84-gr/pre-proxysql.bash @@ -1,6 +1,7 @@ #!/usr/bin/env bash set -e set -o pipefail +REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)" # # change infra config # inherits env from tester script @@ -11,7 +12,7 @@ set -o pipefail INFRA=infra-$(basename $(dirname "$0") | sed 's/-g[0-9]//' | sed 's/_.*//') # destroy running infras -/home/rene/proxysql/test/infra/control/infra-default/docker-compose-destroy.bash +${REPO_ROOT}/test/infra/control/infra-default/docker-compose-destroy.bash # cleanup mysql ${SSLOPT} -h127.0.0.1 -P6032 -uadmin -padmin -e " \ DELETE FROM mysql_users; \ @@ -38,11 +39,11 @@ SAVE PGSQL SERVERS TO DISK; \ " 2>&1 | grep -vP 'mysql: .?Warning' # load environment for infra -source /home/rene/proxysql/test/infra/control/${INFRA}/.env +source ${REPO_ROOT}/test/infra/control/${INFRA}/.env # Start infra -# /home/rene/proxysql/test/infra/control/infra-docker-hoster/docker-compose-init.bash -/home/rene/proxysql/test/infra/control/${INFRA}/docker-compose-init.bash +# ${REPO_ROOT}/test/infra/control/infra-docker-hoster/docker-compose-init.bash +${REPO_ROOT}/test/infra/control/${INFRA}/docker-compose-init.bash # create default users for MYUSER in root user testuser sbtest1 sbtest2 sbtest3 sbtest4 ssluser ; do diff --git a/test/tap/groups/mysql84/pre-proxysql.bash b/test/tap/groups/mysql84/pre-proxysql.bash index b407e30c7e..a9c874b230 100755 --- a/test/tap/groups/mysql84/pre-proxysql.bash +++ b/test/tap/groups/mysql84/pre-proxysql.bash @@ -1,21 +1,22 @@ #!/usr/bin/env bash set -e set -o pipefail +REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)" # # change infra config # inherits env from tester script # # Start ProxySQL Cluster if available -/home/rene/proxysql/test/infra/control/cluster_start.bash -/home/rene/proxysql/test/infra/control/cluster_init.bash +${REPO_ROOT}/test/infra/control/cluster_start.bash +${REPO_ROOT}/test/infra/control/cluster_init.bash [[ $(mysql --skip-ssl-verify-server-cert -h 2>&1) =~ skip-ssl-verify-server-cert ]] || export SSLOPT=--skip-ssl-verify-server-cert INFRA=infra-$(basename $(dirname "$0") | sed 's/-g[0-9]//' | sed 's/_.*//') # destroy running infras -/home/rene/proxysql/test/infra/control/infra-default/docker-compose-destroy.bash +${REPO_ROOT}/test/infra/control/infra-default/docker-compose-destroy.bash # cleanup mysql ${SSLOPT} -h127.0.0.1 -P6032 -uadmin -padmin -e " \ DELETE FROM mysql_users; \ @@ -42,11 +43,11 @@ SAVE PGSQL SERVERS TO DISK; \ " 2>&1 | grep -vP 'mysql: .?Warning' # load environment for infra -source /home/rene/proxysql/test/infra/control/${INFRA}/.env +source ${REPO_ROOT}/test/infra/control/${INFRA}/.env # Start infra -# /home/rene/proxysql/test/infra/control/infra-docker-hoster/docker-compose-init.bash -/home/rene/proxysql/test/infra/control/${INFRA}/docker-compose-init.bash +# ${REPO_ROOT}/test/infra/control/infra-docker-hoster/docker-compose-init.bash +${REPO_ROOT}/test/infra/control/${INFRA}/docker-compose-init.bash # create default users for MYUSER in root user testuser sbtest1 sbtest2 sbtest3 sbtest4 ssluser ; do diff --git a/test/tap/groups/mysql90-gr/pre-proxysql.bash b/test/tap/groups/mysql90-gr/pre-proxysql.bash index c1e7e33c11..4fd4c96d24 100755 --- a/test/tap/groups/mysql90-gr/pre-proxysql.bash +++ b/test/tap/groups/mysql90-gr/pre-proxysql.bash @@ -1,6 +1,7 @@ #!/usr/bin/env bash set -e set -o pipefail +REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)" # # change infra config # inherits env from tester script @@ -11,7 +12,7 @@ set -o pipefail INFRA=infra-$(basename $(dirname "$0") | sed 's/-g[0-9]//' | sed 's/_.*//') # destroy running infras -/home/rene/proxysql/test/infra/control/infra-default/docker-compose-destroy.bash +${REPO_ROOT}/test/infra/control/infra-default/docker-compose-destroy.bash # cleanup mysql ${SSLOPT} -h127.0.0.1 -P6032 -uadmin -padmin -e " \ DELETE FROM mysql_users; \ @@ -38,11 +39,11 @@ SAVE PGSQL SERVERS TO DISK; \ " 2>&1 | grep -vP 'mysql: .?Warning' # load environment for infra -source /home/rene/proxysql/test/infra/control/${INFRA}/.env +source ${REPO_ROOT}/test/infra/control/${INFRA}/.env # Start infra -# /home/rene/proxysql/test/infra/control/infra-docker-hoster/docker-compose-init.bash -/home/rene/proxysql/test/infra/control/${INFRA}/docker-compose-init.bash +# ${REPO_ROOT}/test/infra/control/infra-docker-hoster/docker-compose-init.bash +${REPO_ROOT}/test/infra/control/${INFRA}/docker-compose-init.bash # create default users for MYUSER in root user testuser sbtest1 sbtest2 sbtest3 sbtest4 ssluser ; do diff --git a/test/tap/groups/mysql90/pre-proxysql.bash b/test/tap/groups/mysql90/pre-proxysql.bash index c1e7e33c11..4fd4c96d24 100755 --- a/test/tap/groups/mysql90/pre-proxysql.bash +++ b/test/tap/groups/mysql90/pre-proxysql.bash @@ -1,6 +1,7 @@ #!/usr/bin/env bash set -e set -o pipefail +REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)" # # change infra config # inherits env from tester script @@ -11,7 +12,7 @@ set -o pipefail INFRA=infra-$(basename $(dirname "$0") | sed 's/-g[0-9]//' | sed 's/_.*//') # destroy running infras -/home/rene/proxysql/test/infra/control/infra-default/docker-compose-destroy.bash +${REPO_ROOT}/test/infra/control/infra-default/docker-compose-destroy.bash # cleanup mysql ${SSLOPT} -h127.0.0.1 -P6032 -uadmin -padmin -e " \ DELETE FROM mysql_users; \ @@ -38,11 +39,11 @@ SAVE PGSQL SERVERS TO DISK; \ " 2>&1 | grep -vP 'mysql: .?Warning' # load environment for infra -source /home/rene/proxysql/test/infra/control/${INFRA}/.env +source ${REPO_ROOT}/test/infra/control/${INFRA}/.env # Start infra -# /home/rene/proxysql/test/infra/control/infra-docker-hoster/docker-compose-init.bash -/home/rene/proxysql/test/infra/control/${INFRA}/docker-compose-init.bash +# ${REPO_ROOT}/test/infra/control/infra-docker-hoster/docker-compose-init.bash +${REPO_ROOT}/test/infra/control/${INFRA}/docker-compose-init.bash # create default users for MYUSER in root user testuser sbtest1 sbtest2 sbtest3 sbtest4 ssluser ; do diff --git a/test/tap/groups/mysql91-gr/pre-proxysql.bash b/test/tap/groups/mysql91-gr/pre-proxysql.bash index c1e7e33c11..4fd4c96d24 100755 --- a/test/tap/groups/mysql91-gr/pre-proxysql.bash +++ b/test/tap/groups/mysql91-gr/pre-proxysql.bash @@ -1,6 +1,7 @@ #!/usr/bin/env bash set -e set -o pipefail +REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)" # # change infra config # inherits env from tester script @@ -11,7 +12,7 @@ set -o pipefail INFRA=infra-$(basename $(dirname "$0") | sed 's/-g[0-9]//' | sed 's/_.*//') # destroy running infras -/home/rene/proxysql/test/infra/control/infra-default/docker-compose-destroy.bash +${REPO_ROOT}/test/infra/control/infra-default/docker-compose-destroy.bash # cleanup mysql ${SSLOPT} -h127.0.0.1 -P6032 -uadmin -padmin -e " \ DELETE FROM mysql_users; \ @@ -38,11 +39,11 @@ SAVE PGSQL SERVERS TO DISK; \ " 2>&1 | grep -vP 'mysql: .?Warning' # load environment for infra -source /home/rene/proxysql/test/infra/control/${INFRA}/.env +source ${REPO_ROOT}/test/infra/control/${INFRA}/.env # Start infra -# /home/rene/proxysql/test/infra/control/infra-docker-hoster/docker-compose-init.bash -/home/rene/proxysql/test/infra/control/${INFRA}/docker-compose-init.bash +# ${REPO_ROOT}/test/infra/control/infra-docker-hoster/docker-compose-init.bash +${REPO_ROOT}/test/infra/control/${INFRA}/docker-compose-init.bash # create default users for MYUSER in root user testuser sbtest1 sbtest2 sbtest3 sbtest4 ssluser ; do diff --git a/test/tap/groups/mysql91/pre-proxysql.bash b/test/tap/groups/mysql91/pre-proxysql.bash index c1e7e33c11..4fd4c96d24 100755 --- a/test/tap/groups/mysql91/pre-proxysql.bash +++ b/test/tap/groups/mysql91/pre-proxysql.bash @@ -1,6 +1,7 @@ #!/usr/bin/env bash set -e set -o pipefail +REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)" # # change infra config # inherits env from tester script @@ -11,7 +12,7 @@ set -o pipefail INFRA=infra-$(basename $(dirname "$0") | sed 's/-g[0-9]//' | sed 's/_.*//') # destroy running infras -/home/rene/proxysql/test/infra/control/infra-default/docker-compose-destroy.bash +${REPO_ROOT}/test/infra/control/infra-default/docker-compose-destroy.bash # cleanup mysql ${SSLOPT} -h127.0.0.1 -P6032 -uadmin -padmin -e " \ DELETE FROM mysql_users; \ @@ -38,11 +39,11 @@ SAVE PGSQL SERVERS TO DISK; \ " 2>&1 | grep -vP 'mysql: .?Warning' # load environment for infra -source /home/rene/proxysql/test/infra/control/${INFRA}/.env +source ${REPO_ROOT}/test/infra/control/${INFRA}/.env # Start infra -# /home/rene/proxysql/test/infra/control/infra-docker-hoster/docker-compose-init.bash -/home/rene/proxysql/test/infra/control/${INFRA}/docker-compose-init.bash +# ${REPO_ROOT}/test/infra/control/infra-docker-hoster/docker-compose-init.bash +${REPO_ROOT}/test/infra/control/${INFRA}/docker-compose-init.bash # create default users for MYUSER in root user testuser sbtest1 sbtest2 sbtest3 sbtest4 ssluser ; do diff --git a/test/tap/groups/mysql92-gr/pre-proxysql.bash b/test/tap/groups/mysql92-gr/pre-proxysql.bash index c1e7e33c11..4fd4c96d24 100755 --- a/test/tap/groups/mysql92-gr/pre-proxysql.bash +++ b/test/tap/groups/mysql92-gr/pre-proxysql.bash @@ -1,6 +1,7 @@ #!/usr/bin/env bash set -e set -o pipefail +REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)" # # change infra config # inherits env from tester script @@ -11,7 +12,7 @@ set -o pipefail INFRA=infra-$(basename $(dirname "$0") | sed 's/-g[0-9]//' | sed 's/_.*//') # destroy running infras -/home/rene/proxysql/test/infra/control/infra-default/docker-compose-destroy.bash +${REPO_ROOT}/test/infra/control/infra-default/docker-compose-destroy.bash # cleanup mysql ${SSLOPT} -h127.0.0.1 -P6032 -uadmin -padmin -e " \ DELETE FROM mysql_users; \ @@ -38,11 +39,11 @@ SAVE PGSQL SERVERS TO DISK; \ " 2>&1 | grep -vP 'mysql: .?Warning' # load environment for infra -source /home/rene/proxysql/test/infra/control/${INFRA}/.env +source ${REPO_ROOT}/test/infra/control/${INFRA}/.env # Start infra -# /home/rene/proxysql/test/infra/control/infra-docker-hoster/docker-compose-init.bash -/home/rene/proxysql/test/infra/control/${INFRA}/docker-compose-init.bash +# ${REPO_ROOT}/test/infra/control/infra-docker-hoster/docker-compose-init.bash +${REPO_ROOT}/test/infra/control/${INFRA}/docker-compose-init.bash # create default users for MYUSER in root user testuser sbtest1 sbtest2 sbtest3 sbtest4 ssluser ; do diff --git a/test/tap/groups/mysql92/pre-proxysql.bash b/test/tap/groups/mysql92/pre-proxysql.bash index c1e7e33c11..4fd4c96d24 100755 --- a/test/tap/groups/mysql92/pre-proxysql.bash +++ b/test/tap/groups/mysql92/pre-proxysql.bash @@ -1,6 +1,7 @@ #!/usr/bin/env bash set -e set -o pipefail +REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)" # # change infra config # inherits env from tester script @@ -11,7 +12,7 @@ set -o pipefail INFRA=infra-$(basename $(dirname "$0") | sed 's/-g[0-9]//' | sed 's/_.*//') # destroy running infras -/home/rene/proxysql/test/infra/control/infra-default/docker-compose-destroy.bash +${REPO_ROOT}/test/infra/control/infra-default/docker-compose-destroy.bash # cleanup mysql ${SSLOPT} -h127.0.0.1 -P6032 -uadmin -padmin -e " \ DELETE FROM mysql_users; \ @@ -38,11 +39,11 @@ SAVE PGSQL SERVERS TO DISK; \ " 2>&1 | grep -vP 'mysql: .?Warning' # load environment for infra -source /home/rene/proxysql/test/infra/control/${INFRA}/.env +source ${REPO_ROOT}/test/infra/control/${INFRA}/.env # Start infra -# /home/rene/proxysql/test/infra/control/infra-docker-hoster/docker-compose-init.bash -/home/rene/proxysql/test/infra/control/${INFRA}/docker-compose-init.bash +# ${REPO_ROOT}/test/infra/control/infra-docker-hoster/docker-compose-init.bash +${REPO_ROOT}/test/infra/control/${INFRA}/docker-compose-init.bash # create default users for MYUSER in root user testuser sbtest1 sbtest2 sbtest3 sbtest4 ssluser ; do diff --git a/test/tap/groups/mysql93-gr/pre-proxysql.bash b/test/tap/groups/mysql93-gr/pre-proxysql.bash index c1e7e33c11..4fd4c96d24 100755 --- a/test/tap/groups/mysql93-gr/pre-proxysql.bash +++ b/test/tap/groups/mysql93-gr/pre-proxysql.bash @@ -1,6 +1,7 @@ #!/usr/bin/env bash set -e set -o pipefail +REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)" # # change infra config # inherits env from tester script @@ -11,7 +12,7 @@ set -o pipefail INFRA=infra-$(basename $(dirname "$0") | sed 's/-g[0-9]//' | sed 's/_.*//') # destroy running infras -/home/rene/proxysql/test/infra/control/infra-default/docker-compose-destroy.bash +${REPO_ROOT}/test/infra/control/infra-default/docker-compose-destroy.bash # cleanup mysql ${SSLOPT} -h127.0.0.1 -P6032 -uadmin -padmin -e " \ DELETE FROM mysql_users; \ @@ -38,11 +39,11 @@ SAVE PGSQL SERVERS TO DISK; \ " 2>&1 | grep -vP 'mysql: .?Warning' # load environment for infra -source /home/rene/proxysql/test/infra/control/${INFRA}/.env +source ${REPO_ROOT}/test/infra/control/${INFRA}/.env # Start infra -# /home/rene/proxysql/test/infra/control/infra-docker-hoster/docker-compose-init.bash -/home/rene/proxysql/test/infra/control/${INFRA}/docker-compose-init.bash +# ${REPO_ROOT}/test/infra/control/infra-docker-hoster/docker-compose-init.bash +${REPO_ROOT}/test/infra/control/${INFRA}/docker-compose-init.bash # create default users for MYUSER in root user testuser sbtest1 sbtest2 sbtest3 sbtest4 ssluser ; do diff --git a/test/tap/groups/mysql93/pre-proxysql.bash b/test/tap/groups/mysql93/pre-proxysql.bash index c1e7e33c11..4fd4c96d24 100755 --- a/test/tap/groups/mysql93/pre-proxysql.bash +++ b/test/tap/groups/mysql93/pre-proxysql.bash @@ -1,6 +1,7 @@ #!/usr/bin/env bash set -e set -o pipefail +REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)" # # change infra config # inherits env from tester script @@ -11,7 +12,7 @@ set -o pipefail INFRA=infra-$(basename $(dirname "$0") | sed 's/-g[0-9]//' | sed 's/_.*//') # destroy running infras -/home/rene/proxysql/test/infra/control/infra-default/docker-compose-destroy.bash +${REPO_ROOT}/test/infra/control/infra-default/docker-compose-destroy.bash # cleanup mysql ${SSLOPT} -h127.0.0.1 -P6032 -uadmin -padmin -e " \ DELETE FROM mysql_users; \ @@ -38,11 +39,11 @@ SAVE PGSQL SERVERS TO DISK; \ " 2>&1 | grep -vP 'mysql: .?Warning' # load environment for infra -source /home/rene/proxysql/test/infra/control/${INFRA}/.env +source ${REPO_ROOT}/test/infra/control/${INFRA}/.env # Start infra -# /home/rene/proxysql/test/infra/control/infra-docker-hoster/docker-compose-init.bash -/home/rene/proxysql/test/infra/control/${INFRA}/docker-compose-init.bash +# ${REPO_ROOT}/test/infra/control/infra-docker-hoster/docker-compose-init.bash +${REPO_ROOT}/test/infra/control/${INFRA}/docker-compose-init.bash # create default users for MYUSER in root user testuser sbtest1 sbtest2 sbtest3 sbtest4 ssluser ; do From 0c58d1c645682f747aa8fc9c561a02c10b05f983 Mon Sep 17 00:00:00 2001 From: Rene Cannao Date: Sun, 22 Mar 2026 19:42:16 +0000 Subject: [PATCH 03/22] Fix REPO_ROOT derivation: 4 levels up from test/tap/groups// Scripts are at test/tap/groups//pre-proxysql.bash, need 4 parent traversals to reach repo root, not 3. Co-Authored-By: Claude Opus 4.6 (1M context) --- test/tap/groups/default/pre-proxysql.bash | 2 +- test/tap/groups/legacy/pre-proxysql.bash | 2 +- test/tap/groups/mysql84-gr/pre-proxysql.bash | 2 +- test/tap/groups/mysql84/pre-proxysql.bash | 2 +- test/tap/groups/mysql90-gr/pre-proxysql.bash | 2 +- test/tap/groups/mysql90/pre-proxysql.bash | 2 +- test/tap/groups/mysql91-gr/pre-proxysql.bash | 2 +- test/tap/groups/mysql91/pre-proxysql.bash | 2 +- test/tap/groups/mysql92-gr/pre-proxysql.bash | 2 +- test/tap/groups/mysql92/pre-proxysql.bash | 2 +- test/tap/groups/mysql93-gr/pre-proxysql.bash | 2 +- test/tap/groups/mysql93/pre-proxysql.bash | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/test/tap/groups/default/pre-proxysql.bash b/test/tap/groups/default/pre-proxysql.bash index d55551f698..fc380afc6b 100755 --- a/test/tap/groups/default/pre-proxysql.bash +++ b/test/tap/groups/default/pre-proxysql.bash @@ -9,7 +9,7 @@ set -o pipefail # Start ProxySQL Cluster if available SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -REPO_ROOT="$(cd "${SCRIPT_DIR}/../../.." && pwd)" +REPO_ROOT="$(cd "${SCRIPT_DIR}/../../../.." && pwd)" "${REPO_ROOT}/test/infra/control/cluster_start.bash" "${REPO_ROOT}/test/infra/control/cluster_init.bash" diff --git a/test/tap/groups/legacy/pre-proxysql.bash b/test/tap/groups/legacy/pre-proxysql.bash index f7daac7cc6..dd651bb37a 100755 --- a/test/tap/groups/legacy/pre-proxysql.bash +++ b/test/tap/groups/legacy/pre-proxysql.bash @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -e set -o pipefail -REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)" +REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." && pwd)" # # Start ProxySQL Cluster if available # inherits env from tester script diff --git a/test/tap/groups/mysql84-gr/pre-proxysql.bash b/test/tap/groups/mysql84-gr/pre-proxysql.bash index 4fd4c96d24..98623bc3dd 100755 --- a/test/tap/groups/mysql84-gr/pre-proxysql.bash +++ b/test/tap/groups/mysql84-gr/pre-proxysql.bash @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -e set -o pipefail -REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)" +REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." && pwd)" # # change infra config # inherits env from tester script diff --git a/test/tap/groups/mysql84/pre-proxysql.bash b/test/tap/groups/mysql84/pre-proxysql.bash index a9c874b230..8f9f1a19bc 100755 --- a/test/tap/groups/mysql84/pre-proxysql.bash +++ b/test/tap/groups/mysql84/pre-proxysql.bash @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -e set -o pipefail -REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)" +REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." && pwd)" # # change infra config # inherits env from tester script diff --git a/test/tap/groups/mysql90-gr/pre-proxysql.bash b/test/tap/groups/mysql90-gr/pre-proxysql.bash index 4fd4c96d24..98623bc3dd 100755 --- a/test/tap/groups/mysql90-gr/pre-proxysql.bash +++ b/test/tap/groups/mysql90-gr/pre-proxysql.bash @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -e set -o pipefail -REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)" +REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." && pwd)" # # change infra config # inherits env from tester script diff --git a/test/tap/groups/mysql90/pre-proxysql.bash b/test/tap/groups/mysql90/pre-proxysql.bash index 4fd4c96d24..98623bc3dd 100755 --- a/test/tap/groups/mysql90/pre-proxysql.bash +++ b/test/tap/groups/mysql90/pre-proxysql.bash @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -e set -o pipefail -REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)" +REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." && pwd)" # # change infra config # inherits env from tester script diff --git a/test/tap/groups/mysql91-gr/pre-proxysql.bash b/test/tap/groups/mysql91-gr/pre-proxysql.bash index 4fd4c96d24..98623bc3dd 100755 --- a/test/tap/groups/mysql91-gr/pre-proxysql.bash +++ b/test/tap/groups/mysql91-gr/pre-proxysql.bash @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -e set -o pipefail -REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)" +REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." && pwd)" # # change infra config # inherits env from tester script diff --git a/test/tap/groups/mysql91/pre-proxysql.bash b/test/tap/groups/mysql91/pre-proxysql.bash index 4fd4c96d24..98623bc3dd 100755 --- a/test/tap/groups/mysql91/pre-proxysql.bash +++ b/test/tap/groups/mysql91/pre-proxysql.bash @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -e set -o pipefail -REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)" +REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." && pwd)" # # change infra config # inherits env from tester script diff --git a/test/tap/groups/mysql92-gr/pre-proxysql.bash b/test/tap/groups/mysql92-gr/pre-proxysql.bash index 4fd4c96d24..98623bc3dd 100755 --- a/test/tap/groups/mysql92-gr/pre-proxysql.bash +++ b/test/tap/groups/mysql92-gr/pre-proxysql.bash @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -e set -o pipefail -REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)" +REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." && pwd)" # # change infra config # inherits env from tester script diff --git a/test/tap/groups/mysql92/pre-proxysql.bash b/test/tap/groups/mysql92/pre-proxysql.bash index 4fd4c96d24..98623bc3dd 100755 --- a/test/tap/groups/mysql92/pre-proxysql.bash +++ b/test/tap/groups/mysql92/pre-proxysql.bash @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -e set -o pipefail -REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)" +REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." && pwd)" # # change infra config # inherits env from tester script diff --git a/test/tap/groups/mysql93-gr/pre-proxysql.bash b/test/tap/groups/mysql93-gr/pre-proxysql.bash index 4fd4c96d24..98623bc3dd 100755 --- a/test/tap/groups/mysql93-gr/pre-proxysql.bash +++ b/test/tap/groups/mysql93-gr/pre-proxysql.bash @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -e set -o pipefail -REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)" +REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." && pwd)" # # change infra config # inherits env from tester script diff --git a/test/tap/groups/mysql93/pre-proxysql.bash b/test/tap/groups/mysql93/pre-proxysql.bash index 4fd4c96d24..98623bc3dd 100755 --- a/test/tap/groups/mysql93/pre-proxysql.bash +++ b/test/tap/groups/mysql93/pre-proxysql.bash @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -e set -o pipefail -REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)" +REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." && pwd)" # # change infra config # inherits env from tester script From 3389217e98900ce48fd83ee4313c0c12b8058298 Mon Sep 17 00:00:00 2001 From: Rene Cannao Date: Sun, 22 Mar 2026 19:53:34 +0000 Subject: [PATCH 04/22] Default WITHGCOV=0 in env-isolated.bash Code coverage should be opt-in, not default. Non-coverage builds fail with 'PROXYSQL GCOV DUMP' syntax error when WITHGCOV defaults to 1. Co-Authored-By: Claude Opus 4.6 (1M context) --- test/infra/control/env-isolated.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/infra/control/env-isolated.bash b/test/infra/control/env-isolated.bash index 096da63883..31df50e929 100755 --- a/test/infra/control/env-isolated.bash +++ b/test/infra/control/env-isolated.bash @@ -73,7 +73,7 @@ export MALLOC_CONF="retain:false" export PROXYSQL_LAYOUT="flat" # Test execution defaults -export WITHGCOV="${WITHGCOV:-1}" +export WITHGCOV="${WITHGCOV:-0}" export WITHASAN="${WITHASAN:-0}" export TEST_EXIT_ON_FAIL="${TEST_EXIT_ON_FAIL:-0}" export TEST_JDBC="${TEST_JDBC:-1}" From 6d90bc2a7e7ae03631c7bf7e55e2fe449a28477f Mon Sep 17 00:00:00 2001 From: Rene Cannao Date: Sun, 22 Mar 2026 20:03:37 +0000 Subject: [PATCH 05/22] Source group env.sh inside test runner container The group's env.sh (setting TEST_PY_* flags) was only sourced on the host. The Docker test runner container didn't see these values, so env-isolated.bash defaults took over (all tests disabled). Now source group env.sh before env-isolated.bash inside the container so group-specific settings are preserved. Co-Authored-By: Claude Opus 4.6 (1M context) --- test/infra/control/run-tests-isolated.bash | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/test/infra/control/run-tests-isolated.bash b/test/infra/control/run-tests-isolated.bash index dec518800e..2922637e6f 100755 --- a/test/infra/control/run-tests-isolated.bash +++ b/test/infra/control/run-tests-isolated.bash @@ -319,7 +319,17 @@ docker run \ [ -n \"${MYSQL_BINLOG_BIN}\" ] && ln -sf \"${MYSQL_BINLOG_BIN}\" \"${WORKSPACE}/test-scripts/deps/mysqlbinlog\" [ -n \"${BINLOG_READER_BIN}\" ] && ln -sf \"${BINLOG_READER_BIN}\" \"${WORKSPACE}/test-scripts/deps/test_binlog_reader-t\" - # Source the local isolated environment + # Source group environment first (sets TEST_PY_* flags etc.) + if [ -n \"${TAP_GROUP}\" ]; then + BASE_GROUP=\$(echo \"${TAP_GROUP}\" | sed -E 's/[-_]g[0-9]+.*//') + if [ -f \"${WORKSPACE}/test/tap/groups/${TAP_GROUP}/env.sh\" ]; then + source \"${WORKSPACE}/test/tap/groups/${TAP_GROUP}/env.sh\" + elif [ -f \"${WORKSPACE}/test/tap/groups/\${BASE_GROUP}/env.sh\" ]; then + source \"${WORKSPACE}/test/tap/groups/\${BASE_GROUP}/env.sh\" + fi + fi + + # Source the local isolated environment (defaults for unset vars) source ${SCRIPT_DIR}/env-isolated.bash # Dump ProxySQL configuration before running tests From b93a1a164ccc1c02b37726b390a7d5b09dc0b68e Mon Sep 17 00:00:00 2001 From: Rene Cannao Date: Sun, 22 Mar 2026 20:36:58 +0000 Subject: [PATCH 06/22] Remove jenkins-build-scripts dependencies from test scripts - Update proxysql-tester.yml: benchmark script path uses $WORKSPACE - Remove all JENKINS_SCRIPTS_PATH references from proxysql-tester.py - Use TAP env vars in local-docker-benchmark.bash for host/port/password Co-Authored-By: Claude Opus 4.6 (1M context) --- test/infra/infra-mysql57/bin/local-docker-benchmark.bash | 8 +++----- test/scripts/bin/proxysql-tester.py | 4 ++-- test/scripts/etc/proxysql-tester.yml | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/test/infra/infra-mysql57/bin/local-docker-benchmark.bash b/test/infra/infra-mysql57/bin/local-docker-benchmark.bash index 45b2f558d1..e4e575d09a 100755 --- a/test/infra/infra-mysql57/bin/local-docker-benchmark.bash +++ b/test/infra/infra-mysql57/bin/local-docker-benchmark.bash @@ -9,11 +9,9 @@ SIZE_TABLES=10 REPORT_INTERVAL=1 TIME=10 SCRIPT=oltp_read_write.lua -MYSQL_HOST=127.0.0.1 -#MYSQL_HOST=mysql1.infra-mysql57 -MYSQL_PORT=6033 -#MYSQL_PORT=3306 -MYSQL_PWD=root +MYSQL_HOST=${TAP_ROOTHOST:-127.0.0.1} +MYSQL_PORT=${TAP_ROOTPORT:-6033} +MYSQL_PWD=${TAP_ROOTPASSWORD:-root} printf "[$(date)] Dropping 'sysbench' schema if present and preparing test dataset:\n" mysql -h$MYSQL_HOST -P$MYSQL_PORT -uroot -p$MYSQL_PWD -e"DROP DATABASE IF EXISTS sysbench; CREATE DATABASE IF NOT EXISTS sysbench;" 2>&1 | grep -vP 'mysql: .?Warning' diff --git a/test/scripts/bin/proxysql-tester.py b/test/scripts/bin/proxysql-tester.py index 311e31f52d..be4fcfe9f3 100755 --- a/test/scripts/bin/proxysql-tester.py +++ b/test/scripts/bin/proxysql-tester.py @@ -806,7 +806,7 @@ def disk_usage(): if test_file in zero_sec_level_tap_tests: tap_env["OPENSSL_CONF"] = ( - os.environ["JENKINS_SCRIPTS_PATH"] + "/test-scripts/datadir/openssl_level_zero.cnf" + os.environ.get("WORKSPACE", ".") + "/test-scripts/datadir/openssl_level_zero.cnf" ) try: @@ -1551,7 +1551,7 @@ def start_proxysql(conn_args, timeout): subprocess.call( args="./test-scripts/proxysql_cluster_init.sh", shell=True, - cwd=os.environ["JENKINS_SCRIPTS_PATH"], + cwd=os.environ.get("WORKSPACE", "."), env=os.environ.copy() ) diff --git a/test/scripts/etc/proxysql-tester.yml b/test/scripts/etc/proxysql-tester.yml index 45ef575f15..bbde1ec6ca 100644 --- a/test/scripts/etc/proxysql-tester.yml +++ b/test/scripts/etc/proxysql-tester.yml @@ -1,3 +1,3 @@ GLOBAL: OG_API_KEY: c4a8af4e-ac7c-4641-81b4-bd4935b46af4 - BENCHMARK_SCRIPT: $JENKINS_SCRIPTS_PATH/docker-mysql-proxysql/bin/local-docker-benchmark.bash + BENCHMARK_SCRIPT: $WORKSPACE/test/infra/infra-mysql57/bin/local-docker-benchmark.bash From 29fec9d9ff859b48f68624afa52169386b7380ed Mon Sep 17 00:00:00 2001 From: Rene Cannao Date: Sun, 22 Mar 2026 20:45:33 +0000 Subject: [PATCH 07/22] Add hostgroup aliasing hook for basictests group The in-repo infra uses hostgroup pairs like 1300/1301, but the legacy proxysql-tester.py benchmark validates against hostgroups 0 and 1. This setup hook copies the first hostgroup pair into 0/1 and remaps users and query rules accordingly. Benchmark and change_user tests now pass locally. Co-Authored-By: Claude Opus 4.6 (1M context) --- test/tap/groups/basictests/setup-infras.bash | 57 ++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100755 test/tap/groups/basictests/setup-infras.bash diff --git a/test/tap/groups/basictests/setup-infras.bash b/test/tap/groups/basictests/setup-infras.bash new file mode 100755 index 0000000000..7a3a746719 --- /dev/null +++ b/test/tap/groups/basictests/setup-infras.bash @@ -0,0 +1,57 @@ +#!/bin/bash +set -e +set -o pipefail +# +# Basictests setup hook +# +# The in-repo infra configures servers in hostgroup pairs like 1300/1301. +# The legacy test scripts (proxysql-tester.py benchmark) expect servers +# in hostgroups 0 and 1. This hook copies the first hostgroup pair into +# hostgroups 0/1 and remaps users/rules accordingly. +# + +export INFRA_ID="${INFRA_ID:-dev-$USER}" +PROXY_CONTAINER="proxysql.${INFRA_ID}" + +MYSQL_CMD="docker exec ${PROXY_CONTAINER} mysql -uradmin -pradmin -h127.0.0.1 -P6032 -NB" + +# Find the first writer/reader hostgroup pair from mysql_replication_hostgroups +PAIR=$(${MYSQL_CMD} -e "SELECT writer_hostgroup, reader_hostgroup FROM mysql_replication_hostgroups LIMIT 1;" 2>/dev/null) +if [ -z "${PAIR}" ]; then + echo ">>> No replication hostgroups found. Skipping hostgroup aliasing." + exit 0 +fi + +WRITER_HG=$(echo "${PAIR}" | awk '{print $1}') +READER_HG=$(echo "${PAIR}" | awk '{print $2}') + +if [ "${WRITER_HG}" = "0" ] && [ "${READER_HG}" = "1" ]; then + echo ">>> Hostgroups already 0/1. Skipping aliasing." + exit 0 +fi + +echo ">>> Aliasing hostgroup pair ${WRITER_HG}/${READER_HG} -> 0/1" + +# Copy servers from the original hostgroups into 0/1 +${MYSQL_CMD} -e " + INSERT OR IGNORE INTO mysql_servers (hostgroup_id, hostname, port, max_connections, comment) + SELECT 0, hostname, port, max_connections, comment + FROM mysql_servers WHERE hostgroup_id = ${WRITER_HG}; + INSERT OR IGNORE INTO mysql_servers (hostgroup_id, hostname, port, max_connections, comment) + SELECT 1, hostname, port, max_connections, comment + FROM mysql_servers WHERE hostgroup_id = ${READER_HG}; + INSERT OR IGNORE INTO mysql_replication_hostgroups (writer_hostgroup, reader_hostgroup, comment) + VALUES (0, 1, 'basictests alias'); +" + +# Remap users, query rules, and replication hostgroups to 0/1 +${MYSQL_CMD} -e "UPDATE mysql_users SET default_hostgroup = 0 WHERE default_hostgroup = ${WRITER_HG};" +${MYSQL_CMD} -e "UPDATE mysql_query_rules SET destination_hostgroup = 0 WHERE destination_hostgroup = ${WRITER_HG};" +${MYSQL_CMD} -e "UPDATE mysql_query_rules SET destination_hostgroup = 1 WHERE destination_hostgroup = ${READER_HG};" + +# Load all changes to runtime +${MYSQL_CMD} -e "LOAD MYSQL SERVERS TO RUNTIME;" +${MYSQL_CMD} -e "LOAD MYSQL USERS TO RUNTIME;" +${MYSQL_CMD} -e "LOAD MYSQL QUERY RULES TO RUNTIME;" + +echo ">>> Hostgroup aliasing done." From 9cf64fd7ff7fa56945e639b1c5253abc9b5171de Mon Sep 17 00:00:00 2001 From: Rene Cannao Date: Sun, 22 Mar 2026 20:54:16 +0000 Subject: [PATCH 08/22] Fix failover test: use DEFAULT_MYSQL_INFRA for orchestrator DNS names The failover test had hardcoded 'infra-mysql57' hostnames and short aliases like 'mysql1' that don't resolve in the isolated Docker network. Now uses DEFAULT_MYSQL_INFRA env var to construct the correct DNS names (e.g. orc1.infra-mysql57, mysql1.infra-mysql57). All three basictests now pass locally: benchmark, change_user, failover. Co-Authored-By: Claude Opus 4.6 (1M context) --- test/scripts/bin/proxysql-tester.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/test/scripts/bin/proxysql-tester.py b/test/scripts/bin/proxysql-tester.py index be4fcfe9f3..50c15d828f 100755 --- a/test/scripts/bin/proxysql-tester.py +++ b/test/scripts/bin/proxysql-tester.py @@ -1129,18 +1129,21 @@ def run_failover(self): summary = [] self.pre_failover_tests() + mysql_infra = os.environ.get('DEFAULT_MYSQL_INFRA', 'infra-mysql57') if os.environ['DOCKER_MODE'].endswith('dns'): - orc_prefix = 'ORCHESTRATOR_API="http://orc1.infra-mysql57:3000/api http://orc2.infra-mysql57:3000/api http://orc3.infra-mysql57:3000/api"' + orc_prefix = 'ORCHESTRATOR_API="http://orc1.{infra}:3000/api http://orc2.{infra}:3000/api http://orc3.{infra}:3000/api"'.format(infra=mysql_infra) + mysql1_alias = 'mysql1.{}'.format(mysql_infra) else: orc_prefix = 'ORCHESTRATOR_API="http://localhost:23101/api http://localhost:23102/api http://localhost:23103/api"' - fo_cmd = '{} orchestrator-client -c graceful-master-takeover-auto -a mysql1'.format(orc_prefix) + mysql1_alias = 'mysql1' + fo_cmd = '{} orchestrator-client -c graceful-master-takeover-auto -a {}'.format(orc_prefix, mysql1_alias) fop = subprocess.Popen(fo_cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) fo_stdout, fo_stderr = fop.communicate() log.debug('Failover output is - {} / {}'.format(fo_stdout, fo_stderr)) - cf_cmd = '{} orchestrator-client -c topology -i mysql1'.format(orc_prefix) + cf_cmd = '{} orchestrator-client -c topology -i {}:3306'.format(orc_prefix, mysql1_alias) cfp = subprocess.Popen(cf_cmd, shell=True, stdout=subprocess.PIPE, @@ -1148,7 +1151,7 @@ def run_failover(self): cf_stdout, cf_stderr = cfp.communicate() log.debug('Topology verification - {} / {}'.format(cf_stdout, cf_stderr)) self.post_failover_tests() - if b"mysql2:3306" in fo_stdout or b"mysql3:3306" in fo_stdout: + if b"mysql2" in fo_stdout or b"mysql3" in fo_stdout: rc = 0 return rc, logs, summary From c1eb55d39ddc40b5ee313ebd3db2d7f88688f7d3 Mon Sep 17 00:00:00 2001 From: Rene Cannao Date: Sun, 22 Mar 2026 21:14:30 +0000 Subject: [PATCH 09/22] Add CI-legacy-g2 and CI-legacy-g2-genai caller workflows Two new CI workflows for the legacy-g2 TAP test group: - CI-legacy-g2: runs against ubuntu22-tap build (standard) - CI-legacy-g2-genai: runs against ubuntu24-tap-genai-gcov build (PROXYSQLGENAI=1, WITHGCOV=1, with coverage report upload) Both use SKIP_CLUSTER_START=1 and TAP_USE_NOISE=1. Reusable workflows are on the GH-Actions branch. Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/CI-legacy-g2-genai.yml | 19 +++++++++++++++++++ .github/workflows/CI-legacy-g2.yml | 19 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 .github/workflows/CI-legacy-g2-genai.yml create mode 100644 .github/workflows/CI-legacy-g2.yml diff --git a/.github/workflows/CI-legacy-g2-genai.yml b/.github/workflows/CI-legacy-g2-genai.yml new file mode 100644 index 0000000000..e39ac6221d --- /dev/null +++ b/.github/workflows/CI-legacy-g2-genai.yml @@ -0,0 +1,19 @@ +name: CI-legacy-g2-genai +run-name: '${{ github.event.workflow_run && github.event.workflow_run.head_branch || github.ref_name }} ${{ github.workflow }} ${{ github.event.workflow_run && github.event.workflow_run.head_sha || github.sha }}' + +on: + workflow_dispatch: + workflow_run: + workflows: [ CI-trigger ] + types: [ in_progress ] + +concurrency: + group: ${{ github.workflow }}-${{ github.event.workflow_run && github.event.workflow_run.head_branch || github.ref_name }} + cancel-in-progress: true + +jobs: + run: + uses: sysown/proxysql/.github/workflows/ci-legacy-g2-genai.yml@GH-Actions + secrets: inherit + with: + trigger: ${{ toJson(github) }} diff --git a/.github/workflows/CI-legacy-g2.yml b/.github/workflows/CI-legacy-g2.yml new file mode 100644 index 0000000000..c452dacb08 --- /dev/null +++ b/.github/workflows/CI-legacy-g2.yml @@ -0,0 +1,19 @@ +name: CI-legacy-g2 +run-name: '${{ github.event.workflow_run && github.event.workflow_run.head_branch || github.ref_name }} ${{ github.workflow }} ${{ github.event.workflow_run && github.event.workflow_run.head_sha || github.sha }}' + +on: + workflow_dispatch: + workflow_run: + workflows: [ CI-trigger ] + types: [ in_progress ] + +concurrency: + group: ${{ github.workflow }}-${{ github.event.workflow_run && github.event.workflow_run.head_branch || github.ref_name }} + cancel-in-progress: true + +jobs: + run: + uses: sysown/proxysql/.github/workflows/ci-legacy-g2.yml@GH-Actions + secrets: inherit + with: + trigger: ${{ toJson(github) }} From bc42730061d4b7f5af9f01db7602a4c6082f1a97 Mon Sep 17 00:00:00 2001 From: Rene Cannao Date: Sun, 22 Mar 2026 21:24:11 +0000 Subject: [PATCH 10/22] Add GitHub Actions CI/CD documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Comprehensive documentation covering: - Two-tier architecture (caller + reusable workflows) - Execution flow and trigger cascade - Build matrix (debian12-dbg, ubuntu22-tap, ubuntu24-tap-genai-gcov) - Cache strategy and key naming - All 25 workflows with status, purpose, and dependencies - Third-party integration testing (10 workflows) - Test infrastructure pipeline (ensure-infras → run-tests → cleanup) - TAP group system and hooks - Guide for adding new test workflows Co-Authored-By: Claude Opus 4.6 (1M context) --- doc/GH-Actions/README.md | 380 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 380 insertions(+) create mode 100644 doc/GH-Actions/README.md diff --git a/doc/GH-Actions/README.md b/doc/GH-Actions/README.md new file mode 100644 index 0000000000..fc8a48efcb --- /dev/null +++ b/doc/GH-Actions/README.md @@ -0,0 +1,380 @@ +# GitHub Actions CI/CD Documentation + +## Architecture + +ProxySQL CI uses a **two-tier workflow architecture**: + +1. **Caller workflows** live on the main branches (e.g. `v3.0`). They are thin wrappers that trigger on events (push, PR, manual dispatch) and delegate to reusable workflows. +2. **Reusable workflows** live on the `GH-Actions` branch. They contain the actual build/test logic, matrix definitions, caching strategy, and infrastructure orchestration. + +This separation allows updating CI logic on the `GH-Actions` branch without touching the main codebase. + +### Execution Flow + +``` +Push/PR + └─► CI-trigger (on: push/pull_request) + │ + ├─[in_progress]─► CI-builds (3 matrix builds, caches artifacts) + │ ├── debian12-dbg + │ ├── ubuntu22-tap + │ └── ubuntu24-tap-genai-gcov + │ + ├─[in_progress]─► CI-legacy-g2 (ubuntu22-tap cache) + ├─[in_progress]─► CI-legacy-g2-genai (ubuntu24-tap-genai-gcov cache) + │ + ├─[completed]──► CI-selftests (ubuntu22-tap cache) + ├─[completed]──► CI-basictests (ubuntu22-tap cache) + ├─[completed]──► CI-maketest (ubuntu22-tap cache) + ├─[completed]──► CI-taptests-groups (ubuntu22-tap cache) [BROKEN: #5521] + ├─[completed]──► CI-taptests (ubuntu22-tap cache) [BROKEN: #5521] + ├─[completed]──► CI-taptests-ssl (ubuntu22-tap cache) [BROKEN: #5521] + ├─[completed]──► CI-taptests-asan (ubuntu22-tap cache) [BROKEN: #5521] + ├─[completed]──► CI-repltests (ubuntu22-tap cache) [BROKEN: #5521] + ├─[completed]──► CI-shuntest (ubuntu22-tap cache) [BROKEN: #5521] + ├─[completed]──► CI-codeql + ├─[completed]──► CI-package-build + │ + └─[completed]──► CI-3p-* (10 third-party integration workflows) +``` + +**Trigger types:** +- `in_progress` — fires as soon as CI-trigger starts. Used by CI-builds (which must run first) and workflows that wait on build caches. +- `completed` — fires after CI-trigger finishes. Used by test workflows that depend on CI-builds having already populated the cache. + +### Concurrency + +Every workflow uses concurrency groups to prevent resource waste: + +```yaml +concurrency: + group: ${{ github.workflow }}-${{ github.ref_name }} + cancel-in-progress: true +``` + +Only one run per workflow per branch is active at any time. A new push cancels the previous run. + +--- + +## CI-trigger + +| | | +|---|---| +| **File** | `CI-trigger.yml` → `ci-trigger.yml@GH-Actions` | +| **Triggers** | Push to version branches (`v[0-9].[0-9x]+...`), pull requests, manual dispatch | +| **Paths ignored** | `.github/**`, `**.md` | +| **Purpose** | Entry point for the entire CI pipeline. Does not do any work itself — its `in_progress` and `completed` events trigger all downstream workflows. | + +--- + +## CI-builds + +| | | +|---|---| +| **File** | `CI-builds.yml` → `ci-builds.yml@GH-Actions` | +| **Triggers** | `CI-trigger` `in_progress`, manual dispatch | +| **Runs on** | `ubuntu-24.04` | +| **Purpose** | Compiles ProxySQL in Docker containers and caches the artifacts for downstream test workflows. | + +### Build Matrix + +| Matrix Entry | Make Target | Build Flags | Use Case | +|---|---|---|---| +| `debian12-dbg` | `make debian12-dbg` | Debug (`-O0 -ggdb`) | 3rd-party integration testing | +| `ubuntu22-tap` | `make ubuntu22-dbg` | Debug + TAP test binaries | Standard TAP testing | +| `ubuntu24-tap-genai-gcov` | `make ubuntu24-dbg` | Debug + `PROXYSQLGENAI=1` + `WITHGCOV=1` | GenAI feature testing with code coverage | + +### Build Flag Injection + +Build flags are injected into `docker-compose.yml` environment before the build runs, using the same pattern for each: + +```yaml +# In the Build step: +if [[ "${{ matrix.type }}" =~ "-asan" ]]; then + sed -i "/command/i \ - WITHASAN=1" docker-compose.yml +fi +if [[ "${{ matrix.type }}" =~ "-genai" ]]; then + sed -i "/command/i \ - PROXYSQLGENAI=1" docker-compose.yml +fi +if [[ "${{ matrix.type }}" =~ "-gcov" ]]; then + sed -i "/command/i \ - WITHGCOV=1" docker-compose.yml +fi +``` + +### Cache Strategy + +Each build produces four cache entries keyed by `{SHA}_{dist}{type}`: + +| Cache Suffix | Contents | Used By | +|---|---|---| +| `_bin` | `.git/` + `binaries/` | Package builds | +| `_src` | `src/` (includes proxysql binary) | All test workflows | +| `_test` | `test/` (includes TAP test binaries) | TAP test workflows | +| `_matrix` | `tap-matrix*.json` files | TAP matrix workflows | + +Caches expire after 7 days of inactivity. + +--- + +## Test Workflows — In-Repo Infrastructure + +These workflows use the `test/infra/` orchestration system (no external dependencies). + +### CI-selftests + +| | | +|---|---| +| **File** | `CI-selftests.yml` → `ci-selftests.yml@GH-Actions` | +| **Cache** | `ubuntu22-tap_src` | +| **Status** | Working | +| **Infrastructure** | None (runs ProxySQL directly on the runner) | +| **What it tests** | ProxySQL self-test commands (`PROXYSQLTEST 1-6`), core dumps, query digest stats | + +### CI-basictests + +| | | +|---|---| +| **File** | `CI-basictests.yml` → `ci-basictests.yml@GH-Actions` | +| **Cache** | `ubuntu22-tap_src` | +| **Status** | Working (migrated from jenkins-build-scripts, PR #5525) | +| **Infrastructure** | MySQL 5.7 (via `test/infra/infra-mysql57/`) | +| **TAP Group** | `basictests` | +| **What it tests** | Sysbench benchmark, COM_CHANGE_USER, orchestrator failover | +| **Env flags** | `SKIP_CLUSTER_START=1` | + +Uses `ensure-infras.bash` → `start-proxysql-isolated.bash` → `run-tests-isolated.bash` pipeline with the `basictests` TAP group. The `setup-infras.bash` hook aliases hostgroup pairs (e.g. 1300/1301 → 0/1) for backwards compatibility with `proxysql-tester.py`. + +### CI-legacy-g2 + +| | | +|---|---| +| **File** | `CI-legacy-g2.yml` → `ci-legacy-g2.yml@GH-Actions` | +| **Cache** | `ubuntu22-tap_src` + `ubuntu22-tap_test` | +| **Status** | New | +| **Infrastructure** | MySQL 5.7, MariaDB 10, PostgreSQL 16, ClickHouse 23 | +| **TAP Group** | `legacy-g2` (44 TAP tests) | +| **Env flags** | `SKIP_CLUSTER_START=1`, `TAP_USE_NOISE=1` | + +Runs the second batch of legacy TAP tests using the standard ubuntu22 build. Noise injection is enabled to help detect race conditions. + +### CI-legacy-g2-genai + +| | | +|---|---| +| **File** | `CI-legacy-g2-genai.yml` → `ci-legacy-g2-genai.yml@GH-Actions` | +| **Cache** | `ubuntu24-tap-genai-gcov_src` + `ubuntu24-tap-genai-gcov_test` | +| **Status** | New | +| **Infrastructure** | MySQL 5.7, MariaDB 10, PostgreSQL 16, ClickHouse 23 | +| **TAP Group** | `legacy-g2` (44 TAP tests) | +| **Env flags** | `SKIP_CLUSTER_START=1`, `TAP_USE_NOISE=1`, `COVERAGE=1` | +| **Artifacts** | Coverage report uploaded as workflow artifact | + +Same tests as CI-legacy-g2 but runs against the GenAI build (`PROXYSQLGENAI=1`) with code coverage enabled (`WITHGCOV=1`). This validates that GenAI features don't break existing functionality. + +### CI-maketest + +| | | +|---|---| +| **File** | `CI-maketest.yml` → `ci-maketest.yml@GH-Actions` | +| **Cache** | `ubuntu22-tap_src` | +| **Status** | Working | +| **Infrastructure** | MySQL 5.7 (Docker) | +| **What it tests** | Runs `make test` inside a Docker build container | + +--- + +## Test Workflows — Broken (Depend on jenkins-build-scripts) + +These workflows still reference the private `proxysql/jenkins-build-scripts` repository and fail with `fatal: repository not found`. See issue #5521 for migration tracking. + +### CI-taptests-groups + +| | | +|---|---| +| **Status** | Broken (#5521) | +| **Purpose** | Runs TAP tests in parallel groups. Dynamically builds a test matrix from `tap-matrix.json`. | +| **Migration** | Medium effort. Most infrastructure exists in-repo (`test/tap/groups/`). | + +### CI-repltests + +| | | +|---|---| +| **Status** | Broken (#5521, #5523) | +| **Purpose** | Replication chain tests with sysbench load and data consistency verification. Tests MySQL 5.6/5.7/8.0 with/without SSL and debezium. | +| **Migration** | Requires porting `proxysql_repl_tests/` from jenkins-build-scripts. | + +### CI-shuntest + +| | | +|---|---| +| **Status** | Broken (#5521) | +| **Purpose** | Backend shunning/failover algorithm tests. Uses the same `proxysql_repl_tests` infrastructure as CI-repltests. | +| **Migration** | Unblocked by CI-repltests migration. | + +### CI-taptests, CI-taptests-ssl, CI-taptests-asan + +| | | +|---|---| +| **Status** | Broken (#5521) | +| **Purpose** | Various TAP test execution modes: standard, SSL-focused, and AddressSanitizer. | +| **Migration** | Similar to CI-taptests-groups. | + +--- + +## CI-package-build + +| | | +|---|---| +| **File** | `CI-package-build.yml` → `ci-package-build.yml@GH-Actions` | +| **Triggers** | Push (not workflow_run) | +| **Status** | Working | +| **Purpose** | Builds `.deb` and `.rpm` packages for distribution. Independent of the CI-trigger cascade. | + +--- + +## CI-codeql + +| | | +|---|---| +| **File** | `CI-codeql.yml` → `ci-codeql.yml@GH-Actions` | +| **Triggers** | `CI-trigger` `completed` | +| **Status** | Working | +| **Purpose** | GitHub CodeQL security analysis. | + +--- + +## Third-Party Integration Workflows (CI-3p-*) + +Ten workflows test ProxySQL against external client libraries and frameworks. They all: +- Trigger on `CI-trigger` `completed` +- Use repository variables for matrix configuration (database versions, connector versions) +- Run separate MySQL and MariaDB/PostgreSQL jobs +- Are independent of the build cache (they build ProxySQL inline) + +| Workflow | Client Library | Protocols | +|---|---|---| +| `CI-3p-aiomysql` | Python aiomysql (async) | MySQL | +| `CI-3p-django-framework` | Django ORM | MySQL, PostgreSQL | +| `CI-3p-laravel-framework` | Laravel Eloquent | MySQL, PostgreSQL | +| `CI-3p-mariadb-connector-c` | MariaDB C connector | MySQL | +| `CI-3p-mysql-connector-j` | MySQL Connector/J (Java) | MySQL | +| `CI-3p-pgjdbc` | PostgreSQL JDBC | PostgreSQL | +| `CI-3p-php-pdo-mysql` | PHP PDO MySQL | MySQL | +| `CI-3p-php-pdo-pgsql` | PHP PDO PostgreSQL | PostgreSQL | +| `CI-3p-postgresql` | libpq (native) | PostgreSQL | +| `CI-3p-sqlalchemy` | SQLAlchemy ORM | MySQL, PostgreSQL | + +### Matrix Variables + +Each 3p workflow reads its test matrix from GitHub repository variables: + +``` +MATRIX_3P_AIOMYSQL_infradb_mysql # e.g. ["mysql57", "mysql84", "mysql91"] +MATRIX_3P_AIOMYSQL_connector_mysql # e.g. ["0.1.1", "0.2.0"] +MATRIX_3P_AIOMYSQL_infradb_mariadb # e.g. ["mariadb105", "mariadb115"] +MATRIX_3P_AIOMYSQL_connector_mariadb # e.g. ["0.1.1", "0.2.0"] +``` + +--- + +## Other Workflows + +### claude.yml + +Claude Code automation for AI-assisted development. Triggers on issue comments, PR comments, and issue assignments. + +### claude-code-review.yml + +Automated code review using Claude. Triggers on pull request events. + +--- + +## Test Infrastructure (test/infra/) + +Test workflows that use the in-repo infrastructure follow this pipeline: + +``` +ensure-infras.bash # Start ProxySQL + backends based on TAP group's infras.lst + ├── start-proxysql-isolated.bash # ProxySQL in Docker container + ├── infra-mysql57/docker-compose-init.bash # MySQL 5.7 (3 nodes + 3 orchestrators) + ├── docker-pgsql16-single/... # PostgreSQL 16 + └── ...other backends from infras.lst + +run-tests-isolated.bash # Launch test runner container + ├── Source group env.sh (TEST_PY_* flags) + ├── Source env-isolated.bash (TAP_* connection vars) + └── Run proxysql-tester.py + +stop-proxysql-isolated.bash # Cleanup ProxySQL +destroy-infras.bash # Cleanup backends +``` + +### TAP Groups + +Tests are organized into groups under `test/tap/groups/`. Each group has: + +| File | Purpose | +|---|---| +| `infras.lst` | Required backend infrastructure (one per line) | +| `env.sh` | Environment overrides (test flags, hostgroup defaults) | +| `pre-proxysql.bash` | Hook: runs before tests (cluster setup) | +| `setup-infras.bash` | Hook: runs after infra is up (hostgroup aliasing, etc.) | +| `pre-cleanup.bash` | Hook: runs before teardown | + +Group assignment is defined in `test/tap/groups/groups.json` which maps test binary names to group names (e.g. `legacy-g1`, `legacy-g2`, `mysql84-g1`, etc.). + +### Key Environment Variables + +| Variable | Default | Purpose | +|---|---|---| +| `INFRA_ID` | `dev-$USER` | Namespace for Docker containers (enables parallel runs) | +| `TAP_GROUP` | — | Which test group to run | +| `SKIP_CLUSTER_START` | `0` | Skip ProxySQL cluster setup | +| `TAP_USE_NOISE` | `0` | Enable random delay injection for race condition testing | +| `COVERAGE` | `0` | Enable code coverage collection | +| `WITHGCOV` | `0` | Tell `proxysql-tester.py` binary was built with gcov | + +--- + +## Adding a New Test Workflow + +To add a new workflow for TAP group `` with build variant ``: + +1. **Reusable workflow** — Create `.github/workflows/ci-.yml` on the `GH-Actions` branch. Use `ci-legacy-g2.yml` as a template. Set the `BLDCACHE` env to match the build variant cache key (e.g. `ubuntu22-tap_src`). + +2. **Caller workflow** — Create `.github/workflows/CI-.yml` on the main branch: + ```yaml + name: CI- + on: + workflow_dispatch: + workflow_run: + workflows: [ CI-trigger ] + types: [ in_progress ] # or completed + jobs: + run: + uses: sysown/proxysql/.github/workflows/ci-.yml@GH-Actions + secrets: inherit + with: + trigger: ${{ toJson(github) }} + ``` + +3. **TAP group** (if new) — Create `test/tap/groups//` with `infras.lst` and `env.sh`. Add test assignments to `groups.json`. + +Use `in_progress` trigger type if the workflow should start building immediately (parallel with CI-builds). Use `completed` if it must wait for CI-builds to finish populating the cache. + +--- + +## File Locations + +| What | Where | +|---|---| +| Caller workflows | `.github/workflows/CI-*.yml` (main branch) | +| Reusable workflows | `.github/workflows/ci-*.yml` (`GH-Actions` branch) | +| Test infrastructure | `test/infra/` | +| Control scripts | `test/infra/control/` | +| TAP groups | `test/tap/groups/` | +| Group-to-test mapping | `test/tap/groups/groups.json` | +| Python test runner | `test/scripts/bin/proxysql-tester.py` | +| Tester config | `test/scripts/etc/proxysql-tester.yml` | +| Docker base image | `test/infra/docker-base/Dockerfile` | +| Migration tracking | Issue #5521 | From eb487560abdd375f5fb4ce35de67a2ec036e7cf7 Mon Sep 17 00:00:00 2001 From: Rene Cannao Date: Sun, 22 Mar 2026 21:54:30 +0000 Subject: [PATCH 11/22] Fix mysql84+ pre-proxysql.bash: remove infra-default, fix infra paths - Remove references to non-existent infra-default/docker-compose-destroy.bash - Fix paths from test/infra/control/${INFRA}/ to test/infra/${INFRA}/ (infra directories live under test/infra/, not test/infra/control/) Affects: mysql84, mysql84-gr, mysql90-mysql93, mysql90-gr-mysql93-gr Co-Authored-By: Claude Opus 4.6 (1M context) --- test/tap/groups/mysql84-gr/pre-proxysql.bash | 6 ++---- test/tap/groups/mysql84/pre-proxysql.bash | 6 ++---- test/tap/groups/mysql90-gr/pre-proxysql.bash | 6 ++---- test/tap/groups/mysql90/pre-proxysql.bash | 6 ++---- test/tap/groups/mysql91-gr/pre-proxysql.bash | 6 ++---- test/tap/groups/mysql91/pre-proxysql.bash | 6 ++---- test/tap/groups/mysql92-gr/pre-proxysql.bash | 6 ++---- test/tap/groups/mysql92/pre-proxysql.bash | 6 ++---- test/tap/groups/mysql93-gr/pre-proxysql.bash | 6 ++---- test/tap/groups/mysql93/pre-proxysql.bash | 6 ++---- 10 files changed, 20 insertions(+), 40 deletions(-) diff --git a/test/tap/groups/mysql84-gr/pre-proxysql.bash b/test/tap/groups/mysql84-gr/pre-proxysql.bash index 98623bc3dd..9c5593549c 100755 --- a/test/tap/groups/mysql84-gr/pre-proxysql.bash +++ b/test/tap/groups/mysql84-gr/pre-proxysql.bash @@ -11,8 +11,6 @@ REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." && pwd)" INFRA=infra-$(basename $(dirname "$0") | sed 's/-g[0-9]//' | sed 's/_.*//') -# destroy running infras -${REPO_ROOT}/test/infra/control/infra-default/docker-compose-destroy.bash # cleanup mysql ${SSLOPT} -h127.0.0.1 -P6032 -uadmin -padmin -e " \ DELETE FROM mysql_users; \ @@ -39,11 +37,11 @@ SAVE PGSQL SERVERS TO DISK; \ " 2>&1 | grep -vP 'mysql: .?Warning' # load environment for infra -source ${REPO_ROOT}/test/infra/control/${INFRA}/.env +source ${REPO_ROOT}/test/infra/${INFRA}/.env # Start infra # ${REPO_ROOT}/test/infra/control/infra-docker-hoster/docker-compose-init.bash -${REPO_ROOT}/test/infra/control/${INFRA}/docker-compose-init.bash +${REPO_ROOT}/test/infra/${INFRA}/docker-compose-init.bash # create default users for MYUSER in root user testuser sbtest1 sbtest2 sbtest3 sbtest4 ssluser ; do diff --git a/test/tap/groups/mysql84/pre-proxysql.bash b/test/tap/groups/mysql84/pre-proxysql.bash index 8f9f1a19bc..380fea5921 100755 --- a/test/tap/groups/mysql84/pre-proxysql.bash +++ b/test/tap/groups/mysql84/pre-proxysql.bash @@ -15,8 +15,6 @@ ${REPO_ROOT}/test/infra/control/cluster_init.bash INFRA=infra-$(basename $(dirname "$0") | sed 's/-g[0-9]//' | sed 's/_.*//') -# destroy running infras -${REPO_ROOT}/test/infra/control/infra-default/docker-compose-destroy.bash # cleanup mysql ${SSLOPT} -h127.0.0.1 -P6032 -uadmin -padmin -e " \ DELETE FROM mysql_users; \ @@ -43,11 +41,11 @@ SAVE PGSQL SERVERS TO DISK; \ " 2>&1 | grep -vP 'mysql: .?Warning' # load environment for infra -source ${REPO_ROOT}/test/infra/control/${INFRA}/.env +source ${REPO_ROOT}/test/infra/${INFRA}/.env # Start infra # ${REPO_ROOT}/test/infra/control/infra-docker-hoster/docker-compose-init.bash -${REPO_ROOT}/test/infra/control/${INFRA}/docker-compose-init.bash +${REPO_ROOT}/test/infra/${INFRA}/docker-compose-init.bash # create default users for MYUSER in root user testuser sbtest1 sbtest2 sbtest3 sbtest4 ssluser ; do diff --git a/test/tap/groups/mysql90-gr/pre-proxysql.bash b/test/tap/groups/mysql90-gr/pre-proxysql.bash index 98623bc3dd..9c5593549c 100755 --- a/test/tap/groups/mysql90-gr/pre-proxysql.bash +++ b/test/tap/groups/mysql90-gr/pre-proxysql.bash @@ -11,8 +11,6 @@ REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." && pwd)" INFRA=infra-$(basename $(dirname "$0") | sed 's/-g[0-9]//' | sed 's/_.*//') -# destroy running infras -${REPO_ROOT}/test/infra/control/infra-default/docker-compose-destroy.bash # cleanup mysql ${SSLOPT} -h127.0.0.1 -P6032 -uadmin -padmin -e " \ DELETE FROM mysql_users; \ @@ -39,11 +37,11 @@ SAVE PGSQL SERVERS TO DISK; \ " 2>&1 | grep -vP 'mysql: .?Warning' # load environment for infra -source ${REPO_ROOT}/test/infra/control/${INFRA}/.env +source ${REPO_ROOT}/test/infra/${INFRA}/.env # Start infra # ${REPO_ROOT}/test/infra/control/infra-docker-hoster/docker-compose-init.bash -${REPO_ROOT}/test/infra/control/${INFRA}/docker-compose-init.bash +${REPO_ROOT}/test/infra/${INFRA}/docker-compose-init.bash # create default users for MYUSER in root user testuser sbtest1 sbtest2 sbtest3 sbtest4 ssluser ; do diff --git a/test/tap/groups/mysql90/pre-proxysql.bash b/test/tap/groups/mysql90/pre-proxysql.bash index 98623bc3dd..9c5593549c 100755 --- a/test/tap/groups/mysql90/pre-proxysql.bash +++ b/test/tap/groups/mysql90/pre-proxysql.bash @@ -11,8 +11,6 @@ REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." && pwd)" INFRA=infra-$(basename $(dirname "$0") | sed 's/-g[0-9]//' | sed 's/_.*//') -# destroy running infras -${REPO_ROOT}/test/infra/control/infra-default/docker-compose-destroy.bash # cleanup mysql ${SSLOPT} -h127.0.0.1 -P6032 -uadmin -padmin -e " \ DELETE FROM mysql_users; \ @@ -39,11 +37,11 @@ SAVE PGSQL SERVERS TO DISK; \ " 2>&1 | grep -vP 'mysql: .?Warning' # load environment for infra -source ${REPO_ROOT}/test/infra/control/${INFRA}/.env +source ${REPO_ROOT}/test/infra/${INFRA}/.env # Start infra # ${REPO_ROOT}/test/infra/control/infra-docker-hoster/docker-compose-init.bash -${REPO_ROOT}/test/infra/control/${INFRA}/docker-compose-init.bash +${REPO_ROOT}/test/infra/${INFRA}/docker-compose-init.bash # create default users for MYUSER in root user testuser sbtest1 sbtest2 sbtest3 sbtest4 ssluser ; do diff --git a/test/tap/groups/mysql91-gr/pre-proxysql.bash b/test/tap/groups/mysql91-gr/pre-proxysql.bash index 98623bc3dd..9c5593549c 100755 --- a/test/tap/groups/mysql91-gr/pre-proxysql.bash +++ b/test/tap/groups/mysql91-gr/pre-proxysql.bash @@ -11,8 +11,6 @@ REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." && pwd)" INFRA=infra-$(basename $(dirname "$0") | sed 's/-g[0-9]//' | sed 's/_.*//') -# destroy running infras -${REPO_ROOT}/test/infra/control/infra-default/docker-compose-destroy.bash # cleanup mysql ${SSLOPT} -h127.0.0.1 -P6032 -uadmin -padmin -e " \ DELETE FROM mysql_users; \ @@ -39,11 +37,11 @@ SAVE PGSQL SERVERS TO DISK; \ " 2>&1 | grep -vP 'mysql: .?Warning' # load environment for infra -source ${REPO_ROOT}/test/infra/control/${INFRA}/.env +source ${REPO_ROOT}/test/infra/${INFRA}/.env # Start infra # ${REPO_ROOT}/test/infra/control/infra-docker-hoster/docker-compose-init.bash -${REPO_ROOT}/test/infra/control/${INFRA}/docker-compose-init.bash +${REPO_ROOT}/test/infra/${INFRA}/docker-compose-init.bash # create default users for MYUSER in root user testuser sbtest1 sbtest2 sbtest3 sbtest4 ssluser ; do diff --git a/test/tap/groups/mysql91/pre-proxysql.bash b/test/tap/groups/mysql91/pre-proxysql.bash index 98623bc3dd..9c5593549c 100755 --- a/test/tap/groups/mysql91/pre-proxysql.bash +++ b/test/tap/groups/mysql91/pre-proxysql.bash @@ -11,8 +11,6 @@ REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." && pwd)" INFRA=infra-$(basename $(dirname "$0") | sed 's/-g[0-9]//' | sed 's/_.*//') -# destroy running infras -${REPO_ROOT}/test/infra/control/infra-default/docker-compose-destroy.bash # cleanup mysql ${SSLOPT} -h127.0.0.1 -P6032 -uadmin -padmin -e " \ DELETE FROM mysql_users; \ @@ -39,11 +37,11 @@ SAVE PGSQL SERVERS TO DISK; \ " 2>&1 | grep -vP 'mysql: .?Warning' # load environment for infra -source ${REPO_ROOT}/test/infra/control/${INFRA}/.env +source ${REPO_ROOT}/test/infra/${INFRA}/.env # Start infra # ${REPO_ROOT}/test/infra/control/infra-docker-hoster/docker-compose-init.bash -${REPO_ROOT}/test/infra/control/${INFRA}/docker-compose-init.bash +${REPO_ROOT}/test/infra/${INFRA}/docker-compose-init.bash # create default users for MYUSER in root user testuser sbtest1 sbtest2 sbtest3 sbtest4 ssluser ; do diff --git a/test/tap/groups/mysql92-gr/pre-proxysql.bash b/test/tap/groups/mysql92-gr/pre-proxysql.bash index 98623bc3dd..9c5593549c 100755 --- a/test/tap/groups/mysql92-gr/pre-proxysql.bash +++ b/test/tap/groups/mysql92-gr/pre-proxysql.bash @@ -11,8 +11,6 @@ REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." && pwd)" INFRA=infra-$(basename $(dirname "$0") | sed 's/-g[0-9]//' | sed 's/_.*//') -# destroy running infras -${REPO_ROOT}/test/infra/control/infra-default/docker-compose-destroy.bash # cleanup mysql ${SSLOPT} -h127.0.0.1 -P6032 -uadmin -padmin -e " \ DELETE FROM mysql_users; \ @@ -39,11 +37,11 @@ SAVE PGSQL SERVERS TO DISK; \ " 2>&1 | grep -vP 'mysql: .?Warning' # load environment for infra -source ${REPO_ROOT}/test/infra/control/${INFRA}/.env +source ${REPO_ROOT}/test/infra/${INFRA}/.env # Start infra # ${REPO_ROOT}/test/infra/control/infra-docker-hoster/docker-compose-init.bash -${REPO_ROOT}/test/infra/control/${INFRA}/docker-compose-init.bash +${REPO_ROOT}/test/infra/${INFRA}/docker-compose-init.bash # create default users for MYUSER in root user testuser sbtest1 sbtest2 sbtest3 sbtest4 ssluser ; do diff --git a/test/tap/groups/mysql92/pre-proxysql.bash b/test/tap/groups/mysql92/pre-proxysql.bash index 98623bc3dd..9c5593549c 100755 --- a/test/tap/groups/mysql92/pre-proxysql.bash +++ b/test/tap/groups/mysql92/pre-proxysql.bash @@ -11,8 +11,6 @@ REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." && pwd)" INFRA=infra-$(basename $(dirname "$0") | sed 's/-g[0-9]//' | sed 's/_.*//') -# destroy running infras -${REPO_ROOT}/test/infra/control/infra-default/docker-compose-destroy.bash # cleanup mysql ${SSLOPT} -h127.0.0.1 -P6032 -uadmin -padmin -e " \ DELETE FROM mysql_users; \ @@ -39,11 +37,11 @@ SAVE PGSQL SERVERS TO DISK; \ " 2>&1 | grep -vP 'mysql: .?Warning' # load environment for infra -source ${REPO_ROOT}/test/infra/control/${INFRA}/.env +source ${REPO_ROOT}/test/infra/${INFRA}/.env # Start infra # ${REPO_ROOT}/test/infra/control/infra-docker-hoster/docker-compose-init.bash -${REPO_ROOT}/test/infra/control/${INFRA}/docker-compose-init.bash +${REPO_ROOT}/test/infra/${INFRA}/docker-compose-init.bash # create default users for MYUSER in root user testuser sbtest1 sbtest2 sbtest3 sbtest4 ssluser ; do diff --git a/test/tap/groups/mysql93-gr/pre-proxysql.bash b/test/tap/groups/mysql93-gr/pre-proxysql.bash index 98623bc3dd..9c5593549c 100755 --- a/test/tap/groups/mysql93-gr/pre-proxysql.bash +++ b/test/tap/groups/mysql93-gr/pre-proxysql.bash @@ -11,8 +11,6 @@ REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." && pwd)" INFRA=infra-$(basename $(dirname "$0") | sed 's/-g[0-9]//' | sed 's/_.*//') -# destroy running infras -${REPO_ROOT}/test/infra/control/infra-default/docker-compose-destroy.bash # cleanup mysql ${SSLOPT} -h127.0.0.1 -P6032 -uadmin -padmin -e " \ DELETE FROM mysql_users; \ @@ -39,11 +37,11 @@ SAVE PGSQL SERVERS TO DISK; \ " 2>&1 | grep -vP 'mysql: .?Warning' # load environment for infra -source ${REPO_ROOT}/test/infra/control/${INFRA}/.env +source ${REPO_ROOT}/test/infra/${INFRA}/.env # Start infra # ${REPO_ROOT}/test/infra/control/infra-docker-hoster/docker-compose-init.bash -${REPO_ROOT}/test/infra/control/${INFRA}/docker-compose-init.bash +${REPO_ROOT}/test/infra/${INFRA}/docker-compose-init.bash # create default users for MYUSER in root user testuser sbtest1 sbtest2 sbtest3 sbtest4 ssluser ; do diff --git a/test/tap/groups/mysql93/pre-proxysql.bash b/test/tap/groups/mysql93/pre-proxysql.bash index 98623bc3dd..9c5593549c 100755 --- a/test/tap/groups/mysql93/pre-proxysql.bash +++ b/test/tap/groups/mysql93/pre-proxysql.bash @@ -11,8 +11,6 @@ REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." && pwd)" INFRA=infra-$(basename $(dirname "$0") | sed 's/-g[0-9]//' | sed 's/_.*//') -# destroy running infras -${REPO_ROOT}/test/infra/control/infra-default/docker-compose-destroy.bash # cleanup mysql ${SSLOPT} -h127.0.0.1 -P6032 -uadmin -padmin -e " \ DELETE FROM mysql_users; \ @@ -39,11 +37,11 @@ SAVE PGSQL SERVERS TO DISK; \ " 2>&1 | grep -vP 'mysql: .?Warning' # load environment for infra -source ${REPO_ROOT}/test/infra/control/${INFRA}/.env +source ${REPO_ROOT}/test/infra/${INFRA}/.env # Start infra # ${REPO_ROOT}/test/infra/control/infra-docker-hoster/docker-compose-init.bash -${REPO_ROOT}/test/infra/control/${INFRA}/docker-compose-init.bash +${REPO_ROOT}/test/infra/${INFRA}/docker-compose-init.bash # create default users for MYUSER in root user testuser sbtest1 sbtest2 sbtest3 sbtest4 ssluser ; do From 75d324680dd9c7b2a5b51349a3c967af7c5aeed7 Mon Sep 17 00:00:00 2001 From: Rene Cannao Date: Sun, 22 Mar 2026 21:55:20 +0000 Subject: [PATCH 12/22] Skip missing unit test binaries instead of counting as failures Unit tests in groups.json may reference binaries that haven't been compiled (they require a separate build step). Previously, not-found binaries were counted as test failures. Now they are skipped with a message, so the group passes if all compiled tests pass. Co-Authored-By: Claude Opus 4.6 (1M context) --- test/infra/control/run-tests-isolated.bash | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/test/infra/control/run-tests-isolated.bash b/test/infra/control/run-tests-isolated.bash index 2922637e6f..7d48f43eab 100755 --- a/test/infra/control/run-tests-isolated.bash +++ b/test/infra/control/run-tests-isolated.bash @@ -171,6 +171,7 @@ for test_name, test_groups in sorted(groups.items()): TOTAL=0 PASSED=0 FAILED=0 + SKIPPED=0 FAILED_TESTS="" for TEST_NAME in ${TEST_NAMES}; do @@ -183,10 +184,8 @@ for test_name, test_groups in sorted(groups.items()): done if [ -z "${TEST_BIN}" ]; then - echo "WARNING: Test binary '${TEST_NAME}' not found in: ${TEST_DIRS}" - TOTAL=$((TOTAL + 1)) - FAILED=$((FAILED + 1)) - FAILED_TESTS="${FAILED_TESTS} ${TEST_NAME}(not-found)" + echo "SKIP: Test binary '${TEST_NAME}' not found (not compiled?)" + SKIPPED=$((SKIPPED + 1)) continue fi @@ -204,7 +203,7 @@ for test_name, test_groups in sorted(groups.items()): echo "" echo "================================================================================" - echo "Unit Test Summary: ${PASSED}/${TOTAL} passed, ${FAILED} failed" + echo "Unit Test Summary: ${PASSED}/${TOTAL} passed, ${FAILED} failed, ${SKIPPED} skipped (not compiled)" if [ -n "${FAILED_TESTS}" ]; then echo "Failed tests:${FAILED_TESTS}" fi From 4dfaedcb84eb642b0f831b7f1ce193488b007e70 Mon Sep 17 00:00:00 2001 From: Rene Cannao Date: Sun, 22 Mar 2026 22:01:18 +0000 Subject: [PATCH 13/22] Revert "Skip missing unit test binaries instead of counting as failures" This reverts commit 75d324680dd9c7b2a5b51349a3c967af7c5aeed7. --- test/infra/control/run-tests-isolated.bash | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/infra/control/run-tests-isolated.bash b/test/infra/control/run-tests-isolated.bash index 7d48f43eab..2922637e6f 100755 --- a/test/infra/control/run-tests-isolated.bash +++ b/test/infra/control/run-tests-isolated.bash @@ -171,7 +171,6 @@ for test_name, test_groups in sorted(groups.items()): TOTAL=0 PASSED=0 FAILED=0 - SKIPPED=0 FAILED_TESTS="" for TEST_NAME in ${TEST_NAMES}; do @@ -184,8 +183,10 @@ for test_name, test_groups in sorted(groups.items()): done if [ -z "${TEST_BIN}" ]; then - echo "SKIP: Test binary '${TEST_NAME}' not found (not compiled?)" - SKIPPED=$((SKIPPED + 1)) + echo "WARNING: Test binary '${TEST_NAME}' not found in: ${TEST_DIRS}" + TOTAL=$((TOTAL + 1)) + FAILED=$((FAILED + 1)) + FAILED_TESTS="${FAILED_TESTS} ${TEST_NAME}(not-found)" continue fi @@ -203,7 +204,7 @@ for test_name, test_groups in sorted(groups.items()): echo "" echo "================================================================================" - echo "Unit Test Summary: ${PASSED}/${TOTAL} passed, ${FAILED} failed, ${SKIPPED} skipped (not compiled)" + echo "Unit Test Summary: ${PASSED}/${TOTAL} passed, ${FAILED} failed" if [ -n "${FAILED_TESTS}" ]; then echo "Failed tests:${FAILED_TESTS}" fi From 577341103e8260aa0fe0990ec3039a076b621f70 Mon Sep 17 00:00:00 2001 From: Rene Cannao Date: Sun, 22 Mar 2026 22:23:00 +0000 Subject: [PATCH 14/22] Fix unit test Makefile: auto-detect feature flags from libproxysql.a MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Unit tests failed to link because feature flags (PROXYSQLCLICKHOUSE, PROXYSQLFFTO, etc.) were only set from environment variables that may not be present during standalone `make` in test/tap/tests/unit/. Now auto-detects which features libproxysql.a was built with by checking for characteristic symbols (ClickHouse_Server, MySQLFFTO, GenAI_Thread, ProxySQL_TSDB). Also fixes ClickHouse→LZ4 link order. All 18 unit test binaries now compile and link successfully. Co-Authored-By: Claude Opus 4.6 (1M context) --- test/tap/tests/unit/Makefile | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/test/tap/tests/unit/Makefile b/test/tap/tests/unit/Makefile index 04a5e77778..022c9c7be1 100644 --- a/test/tap/tests/unit/Makefile +++ b/test/tap/tests/unit/Makefile @@ -101,8 +101,11 @@ STATIC_LIBS := $(CITYHASH_LDIR)/libcityhash.a \ $(LZ4_LDIR)/liblz4.a \ $(ZSTD_LDIR)/libzstd.a -ifeq ($(PROXYSQLCLICKHOUSE),1) - STATIC_LIBS += $(CLICKHOUSE_CPP_LDIR)/libclickhouse-cpp-lib.a +# ClickHouse library: auto-detect if built (always built in current builds) +# Append LZ4/ZSTD again after ClickHouse to resolve its dependencies +ifneq ($(wildcard $(CLICKHOUSE_CPP_LDIR)/libclickhouse-cpp-lib.a),) + STATIC_LIBS += $(CLICKHOUSE_CPP_LDIR)/libclickhouse-cpp-lib.a \ + $(LZ4_LDIR)/liblz4.a $(ZSTD_LDIR)/libzstd.a endif ifeq ($(UNAME_S),Linux) @@ -170,24 +173,32 @@ endif # Compiler flags # =========================================================================== +# Auto-detect feature flags from libproxysql.a symbols. +# This ensures unit tests compile with the same flags the library was built with, +# regardless of whether the environment variables are set during `make`. PSQLCH := -ifeq ($(PROXYSQLCLICKHOUSE),1) +ifneq ($(shell nm $(LIBPROXYSQLAR) 2>/dev/null | grep -c ClickHouse_Server),0) + PROXYSQLCLICKHOUSE := 1 PSQLCH := -DPROXYSQLCLICKHOUSE endif PSQLGA := -ifeq ($(PROXYSQLGENAI),1) +ifneq ($(shell nm $(LIBPROXYSQLAR) 2>/dev/null | grep -c GenAI_Thread),0) + PROXYSQLGENAI := 1 PSQLGA := -DPROXYSQLGENAI endif -PSQL31 := -ifeq ($(PROXYSQL31),1) - PSQL31 := -DPROXYSQL31 -endif PSQLFFTO := -ifeq ($(PROXYSQLFFTO),1) +ifneq ($(shell nm $(LIBPROXYSQLAR) 2>/dev/null | grep -c MySQLFFTO),0) + PROXYSQLFFTO := 1 PSQLFFTO := -DPROXYSQLFFTO endif +PSQL31 := +ifneq ($(shell nm $(LIBPROXYSQLAR) 2>/dev/null | grep -c MySQLFFTO),0) + PROXYSQL31 := 1 + PSQL31 := -DPROXYSQL31 +endif PSQLTSDB := -ifeq ($(PROXYSQLTSDB),1) +ifneq ($(shell nm $(LIBPROXYSQLAR) 2>/dev/null | grep -c ProxySQL_TSDB),0) + PROXYSQLTSDB := 1 PSQLTSDB := -DPROXYSQLTSDB endif From 98fb842c501c77ade2abeb1ea0dc44bae7867ad0 Mon Sep 17 00:00:00 2001 From: Rene Cannao Date: Sun, 22 Mar 2026 22:25:58 +0000 Subject: [PATCH 15/22] Add test/tap/tests/unit/ to TAP_WORKDIRS Unit test binaries live in test/tap/tests/unit/ but TAP_WORKDIRS only included test/tap/tests/ and tests_with_deps/. Without this, proxysql-tester.py cannot find unit test binaries. Co-Authored-By: Claude Opus 4.6 (1M context) --- test/infra/control/env-isolated.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/infra/control/env-isolated.bash b/test/infra/control/env-isolated.bash index 31df50e929..09f77ef8a4 100755 --- a/test/infra/control/env-isolated.bash +++ b/test/infra/control/env-isolated.bash @@ -54,7 +54,7 @@ export TESTS_LOGS_PATH="${WORKSPACE}/ci_infra_logs/${INFRA_ID}/tests" # Test directories and paths export TAP_WORKDIR="${WORKSPACE}/test/tap/tests/" -export TAP_WORKDIRS="${WORKSPACE}/test/tap/tests/ ${WORKSPACE}/test/tap/tests_with_deps/deprecate_eof_support/" +export TAP_WORKDIRS="${WORKSPACE}/test/tap/tests/ ${WORKSPACE}/test/tap/tests_with_deps/deprecate_eof_support/ ${WORKSPACE}/test/tap/tests/unit/" export TAP_DEPS="${WORKSPACE}/test/tap/tap" export TEST_DEPS_PATH="${WORKSPACE}/test-scripts/deps" export TEST_DEPS="${TEST_DEPS_PATH}" From 16e94131fa08a60891d832ec62f2ce77083d9d01 Mon Sep 17 00:00:00 2001 From: Rene Cannao Date: Sun, 22 Mar 2026 22:52:38 +0000 Subject: [PATCH 16/22] Pass MAKECMDGOALS to unit test submake Without this, `make build_tap_test_debug` calls `make` (default target) in test/tap/tests/unit/ instead of `make debug`. The debug target adds -DDEBUG which is needed to define __thread stubs like mysql_thread___session_debug that are guarded by #ifdef DEBUG. Co-Authored-By: Claude Opus 4.6 (1M context) --- test/tap/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/tap/Makefile b/test/tap/Makefile index 2c50397a30..6591ebdf04 100644 --- a/test/tap/Makefile +++ b/test/tap/Makefile @@ -31,7 +31,7 @@ tests_with_deps: tap test_deps .PHONY: unit_tests unit_tests: - cd tests/unit && CC=${CC} CXX=${CXX} ${MAKE} + cd tests/unit && CC=${CC} CXX=${CXX} ${MAKE} $(MAKECMDGOALS) .PHONY: clean_utils From f2db55f0c8aac088a1c40d51bc0630f4ef27eb86 Mon Sep 17 00:00:00 2001 From: Rene Cannao Date: Sun, 22 Mar 2026 23:24:07 +0000 Subject: [PATCH 17/22] Fix basictests hostgroup hook: move instead of copy to avoid monitor conflicts Previously the hook copied servers from 1300/1301 into 0/1, leaving both pairs active. The replication hostgroup monitor managed both pairs simultaneously, causing race conditions that removed servers from 0/1. Now moves servers in-place (UPDATE) and deletes the original 1300/1301 replication entry, so only one pair (0/1) exists for the monitor. Co-Authored-By: Claude Opus 4.6 (1M context) --- test/tap/groups/basictests/setup-infras.bash | 45 +++++++++----------- 1 file changed, 19 insertions(+), 26 deletions(-) diff --git a/test/tap/groups/basictests/setup-infras.bash b/test/tap/groups/basictests/setup-infras.bash index 7a3a746719..2285825958 100755 --- a/test/tap/groups/basictests/setup-infras.bash +++ b/test/tap/groups/basictests/setup-infras.bash @@ -6,8 +6,8 @@ set -o pipefail # # The in-repo infra configures servers in hostgroup pairs like 1300/1301. # The legacy test scripts (proxysql-tester.py benchmark) expect servers -# in hostgroups 0 and 1. This hook copies the first hostgroup pair into -# hostgroups 0/1 and remaps users/rules accordingly. +# in hostgroups 0 and 1. This hook moves everything from the original +# pair to 0/1 and removes the originals to avoid monitor conflicts. # export INFRA_ID="${INFRA_ID:-dev-$USER}" @@ -15,43 +15,36 @@ PROXY_CONTAINER="proxysql.${INFRA_ID}" MYSQL_CMD="docker exec ${PROXY_CONTAINER} mysql -uradmin -pradmin -h127.0.0.1 -P6032 -NB" -# Find the first writer/reader hostgroup pair from mysql_replication_hostgroups -PAIR=$(${MYSQL_CMD} -e "SELECT writer_hostgroup, reader_hostgroup FROM mysql_replication_hostgroups LIMIT 1;" 2>/dev/null) +# Find the first writer/reader hostgroup pair +PAIR=$(${MYSQL_CMD} -e "SELECT writer_hostgroup, reader_hostgroup FROM mysql_replication_hostgroups WHERE writer_hostgroup != 0 LIMIT 1;" 2>/dev/null) if [ -z "${PAIR}" ]; then - echo ">>> No replication hostgroups found. Skipping hostgroup aliasing." + echo ">>> No non-zero replication hostgroups found. Skipping." exit 0 fi WRITER_HG=$(echo "${PAIR}" | awk '{print $1}') READER_HG=$(echo "${PAIR}" | awk '{print $2}') -if [ "${WRITER_HG}" = "0" ] && [ "${READER_HG}" = "1" ]; then - echo ">>> Hostgroups already 0/1. Skipping aliasing." - exit 0 -fi +echo ">>> Remapping hostgroup pair ${WRITER_HG}/${READER_HG} -> 0/1" + +# Move servers: update hostgroup IDs in-place +${MYSQL_CMD} -e "UPDATE mysql_servers SET hostgroup_id = 0 WHERE hostgroup_id = ${WRITER_HG};" +${MYSQL_CMD} -e "UPDATE mysql_servers SET hostgroup_id = 1 WHERE hostgroup_id = ${READER_HG};" -echo ">>> Aliasing hostgroup pair ${WRITER_HG}/${READER_HG} -> 0/1" - -# Copy servers from the original hostgroups into 0/1 -${MYSQL_CMD} -e " - INSERT OR IGNORE INTO mysql_servers (hostgroup_id, hostname, port, max_connections, comment) - SELECT 0, hostname, port, max_connections, comment - FROM mysql_servers WHERE hostgroup_id = ${WRITER_HG}; - INSERT OR IGNORE INTO mysql_servers (hostgroup_id, hostname, port, max_connections, comment) - SELECT 1, hostname, port, max_connections, comment - FROM mysql_servers WHERE hostgroup_id = ${READER_HG}; - INSERT OR IGNORE INTO mysql_replication_hostgroups (writer_hostgroup, reader_hostgroup, comment) - VALUES (0, 1, 'basictests alias'); -" - -# Remap users, query rules, and replication hostgroups to 0/1 +# Replace replication hostgroup mapping +${MYSQL_CMD} -e "DELETE FROM mysql_replication_hostgroups WHERE writer_hostgroup = ${WRITER_HG};" +${MYSQL_CMD} -e "INSERT OR REPLACE INTO mysql_replication_hostgroups (writer_hostgroup, reader_hostgroup, comment) VALUES (0, 1, 'basictests');" + +# Update users ${MYSQL_CMD} -e "UPDATE mysql_users SET default_hostgroup = 0 WHERE default_hostgroup = ${WRITER_HG};" + +# Update query rules ${MYSQL_CMD} -e "UPDATE mysql_query_rules SET destination_hostgroup = 0 WHERE destination_hostgroup = ${WRITER_HG};" ${MYSQL_CMD} -e "UPDATE mysql_query_rules SET destination_hostgroup = 1 WHERE destination_hostgroup = ${READER_HG};" -# Load all changes to runtime +# Load all to runtime ${MYSQL_CMD} -e "LOAD MYSQL SERVERS TO RUNTIME;" ${MYSQL_CMD} -e "LOAD MYSQL USERS TO RUNTIME;" ${MYSQL_CMD} -e "LOAD MYSQL QUERY RULES TO RUNTIME;" -echo ">>> Hostgroup aliasing done." +echo ">>> Hostgroup remapping done." From 648852b2ac5e7659f608281eaa7fcf9b147b79db Mon Sep 17 00:00:00 2001 From: Rene Cannao Date: Sun, 22 Mar 2026 23:44:58 +0000 Subject: [PATCH 18/22] Add debug filters to infra-mysql57 infra-config.sql Additional debug_filters entries for PgSQL, Query_Processor, HostGroups_Manager, and other verbose modules. --- .../infra-mysql57/conf/proxysql/infra-config.sql | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/infra/infra-mysql57/conf/proxysql/infra-config.sql b/test/infra/infra-mysql57/conf/proxysql/infra-config.sql index d6397bf216..597b62e73c 100644 --- a/test/infra/infra-mysql57/conf/proxysql/infra-config.sql +++ b/test/infra/infra-mysql57/conf/proxysql/infra-config.sql @@ -89,6 +89,21 @@ REPLACE INTO debug_filters VALUES ('MySQL_Session.cpp',0,'handler_again___verify REPLACE INTO debug_filters VALUES ('MySQL_Thread.cpp',0,'tune_timeout_for_myds_needs_pause'); REPLACE INTO debug_filters VALUES ('mysql_connection.cpp',0,'handler'); REPLACE INTO debug_filters VALUES ('mysql_connection.cpp',0,'real_query_cont'); +REPLACE INTO debug_filters VALUES ('MySQL_Session.cpp',0,'handler_again___verify_multiple_variables'); +REPLACE INTO debug_filters VALUES ('PgSQL_Session.cpp',0,'handler'); +REPLACE INTO debug_filters VALUES ('PgSQL_Connection.cpp',0,'handler'); +REPLACE INTO debug_filters VALUES ('Base_Thread.cpp',0,'tune_timeout_for_myds_needs_pause'); +REPLACE INTO debug_filters VALUES ('Query_Processor.cpp',0,'process_query'); +REPLACE INTO debug_filters VALUES ('MySQL_Session.cpp',0,'handler___client_DSS_QUERY_SENT___server_DSS_NOT_INITIALIZED'); +REPLACE INTO debug_filters VALUES ('PgSQL_Session.cpp',0,'handler___client_DSS_QUERY_SENT___server_DSS_NOT_INITIALIZED'); +REPLACE INTO debug_filters VALUES ('PgSQL_Session.cpp',0,'handler_again___verify_backend_user_db'); +REPLACE INTO debug_filters VALUES ('PgSQL_Session.cpp',0,'get_pkts_from_client'); +REPLACE INTO debug_filters VALUES ('MySQL_HostGroups_Manager.cpp',0,'push_MyConn_to_pool'); +REPLACE INTO debug_filters VALUES ('MySQL_HostGroups_Manager.cpp',0,'get_MyConn_from_pool'); +REPLACE INTO debug_filters VALUES ('MySrvConnList.cpp',0,'get_random_MyConn'); +REPLACE INTO debug_filters VALUES ('MyHGC.cpp',0,'get_random_MySrvC'); +REPLACE INTO debug_filters VALUES ('PgSQL_Session.cpp',0,'handler___status_WAITING_CLIENT_DATA___STATE_SLEEP___PGSQL_S'); +REPLACE INTO debug_filters VALUES ('PgSQL_HostGroups_Manager.cpp',0,'get_random_MySrvC'); LOAD DEBUG TO RUNTIME; SAVE DEBUG TO DISK; From 7df23de546242514ba623060a9d27287c59bbb05 Mon Sep 17 00:00:00 2001 From: Rene Cannao Date: Mon, 23 Mar 2026 00:33:21 +0000 Subject: [PATCH 19/22] Remove error suppression from ProxySQL config dump queries Stop redirecting stderr to /dev/null and silently continuing on failure. If the config dump queries fail, we need to see the actual error and the test run should fail visibly, not silently proceed with a broken configuration. Co-Authored-By: Claude Opus 4.6 (1M context) --- test/infra/control/run-tests-isolated.bash | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/test/infra/control/run-tests-isolated.bash b/test/infra/control/run-tests-isolated.bash index 2922637e6f..920f793d76 100755 --- a/test/infra/control/run-tests-isolated.bash +++ b/test/infra/control/run-tests-isolated.bash @@ -339,32 +339,32 @@ docker run \ # MySQL configuration echo '--- mysql_servers ---' - mysql -uradmin -pradmin -hproxysql -P6032 -e 'SELECT hostgroup_id, hostname, port, status, comment FROM mysql_servers ORDER BY hostgroup_id, hostname' 2>/dev/null || echo 'ERROR: Failed to query mysql_servers' + mysql -uradmin -pradmin -hproxysql -P6032 -e 'SELECT hostgroup_id, hostname, port, status, comment FROM mysql_servers ORDER BY hostgroup_id, hostname' echo '--- mysql_users ---' - mysql -uradmin -pradmin -hproxysql -P6032 -e 'SELECT username, password, active, default_hostgroup, transaction_persistent FROM mysql_users ORDER BY username' 2>/dev/null || echo 'ERROR: Failed to query mysql_users' + mysql -uradmin -pradmin -hproxysql -P6032 -e 'SELECT username, password, active, default_hostgroup, transaction_persistent FROM mysql_users ORDER BY username' echo '--- mysql_replication_hostgroups ---' - mysql -uradmin -pradmin -hproxysql -P6032 -e 'SELECT writer_hostgroup, reader_hostgroup, comment FROM mysql_replication_hostgroups' 2>/dev/null || echo 'ERROR: Failed to query mysql_replication_hostgroups' + mysql -uradmin -pradmin -hproxysql -P6032 -e 'SELECT writer_hostgroup, reader_hostgroup, comment FROM mysql_replication_hostgroups' echo '--- mysql_query_rules ---' - mysql -uradmin -pradmin -hproxysql -P6032 -e 'SELECT rule_id, active, username, match_pattern, destination_hostgroup, apply, comment FROM mysql_query_rules ORDER BY rule_id' 2>/dev/null || echo 'ERROR: Failed to query mysql_query_rules (or empty)' + mysql -uradmin -pradmin -hproxysql -P6032 -e 'SELECT rule_id, active, username, match_pattern, destination_hostgroup, apply, comment FROM mysql_query_rules ORDER BY rule_id' echo '--- runtime_mysql_query_rules ---' - mysql -uradmin -pradmin -hproxysql -P6032 -e 'SELECT rule_id, active, username, match_pattern, destination_hostgroup, apply, comment FROM runtime_mysql_query_rules ORDER BY rule_id' 2>/dev/null || echo 'ERROR: Failed to query runtime_mysql_query_rules (or empty)' + mysql -uradmin -pradmin -hproxysql -P6032 -e 'SELECT rule_id, active, username, match_pattern, destination_hostgroup, apply, comment FROM runtime_mysql_query_rules ORDER BY rule_id' # PgSQL configuration echo '--- pgsql_servers ---' - mysql -uradmin -pradmin -hproxysql -P6032 -e 'SELECT hostgroup_id, hostname, port, status, comment FROM pgsql_servers ORDER BY hostgroup_id, hostname' 2>/dev/null || echo 'INFO: pgsql_servers not configured (or error)' + mysql -uradmin -pradmin -hproxysql -P6032 -e 'SELECT hostgroup_id, hostname, port, status, comment FROM pgsql_servers ORDER BY hostgroup_id, hostname' echo '--- pgsql_users ---' - mysql -uradmin -pradmin -hproxysql -P6032 -e 'SELECT username, password, active, default_hostgroup FROM pgsql_users ORDER BY username' 2>/dev/null || echo 'INFO: pgsql_users not configured (or error)' + mysql -uradmin -pradmin -hproxysql -P6032 -e 'SELECT username, password, active, default_hostgroup FROM pgsql_users ORDER BY username' echo '--- pgsql_replication_hostgroups ---' - mysql -uradmin -pradmin -hproxysql -P6032 -e 'SELECT writer_hostgroup, reader_hostgroup, comment FROM pgsql_replication_hostgroups' 2>/dev/null || echo 'INFO: pgsql_replication_hostgroups not configured (or error)' + mysql -uradmin -pradmin -hproxysql -P6032 -e 'SELECT writer_hostgroup, reader_hostgroup, comment FROM pgsql_replication_hostgroups' echo '--- pgsql_query_rules ---' - mysql -uradmin -pradmin -hproxysql -P6032 -e 'SELECT rule_id, active, username, match_pattern, destination_hostgroup, apply, comment FROM pgsql_query_rules ORDER BY rule_id' 2>/dev/null || echo 'INFO: pgsql_query_rules not configured (or empty)' + mysql -uradmin -pradmin -hproxysql -P6032 -e 'SELECT rule_id, active, username, match_pattern, destination_hostgroup, apply, comment FROM pgsql_query_rules ORDER BY rule_id' echo '================================================================================' From 09e9207da99001d116df9c16217187bb3fa7a725 Mon Sep 17 00:00:00 2001 From: Rene Cannao Date: Mon, 23 Mar 2026 00:42:15 +0000 Subject: [PATCH 20/22] Move reg_test_3765_ssl_pollout-t from legacy-g2 to legacy-g5 This test does 122-second CPU measurement waits, making it too slow for the legacy-g2 group which needs to complete in a reasonable time. --- test/tap/groups/groups.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/tap/groups/groups.json b/test/tap/groups/groups.json index 528b03cce8..9299b88469 100644 --- a/test/tap/groups/groups.json +++ b/test/tap/groups/groups.json @@ -166,7 +166,7 @@ "reg_test_3606-mysql_warnings-t" : [ "legacy-g1","mysql84-g1","mysql-auto_increment_delay_multiplex=0-g1","mysql-multiplexing=false-g1","mysql-query_digests=0-g1","mysql-query_digests_keep_comment=1-g1" ], "reg_test_3625-sqlite3_session_client_error_limit-t" : [ "legacy-g1","mysql84-g1","mysql-auto_increment_delay_multiplex=0-g1","mysql-multiplexing=false-g1","mysql-query_digests=0-g1","mysql-query_digests_keep_comment=1-g1" ], "reg_test_3690-admin_large_pkts-t" : [ "legacy-g1","mysql84-g1","mysql-auto_increment_delay_multiplex=0-g1","mysql-multiplexing=false-g1","mysql-query_digests=0-g1","mysql-query_digests_keep_comment=1-g1" ], - "reg_test_3765_ssl_pollout-t" : [ "legacy-g2","mysql84-g2","mysql-auto_increment_delay_multiplex=0-g2","mysql-multiplexing=false-g2","mysql-query_digests=0-g2","mysql-query_digests_keep_comment=1-g2" ], + "reg_test_3765_ssl_pollout-t" : [ "legacy-g5","mysql84-g2","mysql-auto_increment_delay_multiplex=0-g2","mysql-multiplexing=false-g2","mysql-query_digests=0-g2","mysql-query_digests_keep_comment=1-g2" ], "reg_test_3838-restapi_eintr-t" : [ "legacy-g2","mysql84-g2","mysql-auto_increment_delay_multiplex=0-g2","mysql-multiplexing=false-g2","mysql-query_digests=0-g2","mysql-query_digests_keep_comment=1-g2" ], "reg_test_3847_admin_lock-t" : [ "legacy-g2","mysql84-g2","mysql-auto_increment_delay_multiplex=0-g2","mysql-multiplexing=false-g2","mysql-query_digests=0-g2","mysql-query_digests_keep_comment=1-g2" ], "reg_test_3992_fast_forward_malformed_packet-mysqlsh-t" : [ "legacy-g2","mysql84-g2","mysql-auto_increment_delay_multiplex=0-g2","mysql-multiplexing=false-g2","mysql-query_digests=0-g2","mysql-query_digests_keep_comment=1-g2" ], From d0872851a619204b85ff3121134301cc3b177bd6 Mon Sep 17 00:00:00 2001 From: Rene Cannao Date: Mon, 23 Mar 2026 00:46:35 +0000 Subject: [PATCH 21/22] Enable coverage when either WITHGCOV or COVERAGE_MODE is set MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit proxysql-tester.py only checked WITHGCOV to decide whether to run PROXYSQL GCOV DUMP. Since WITHGCOV now defaults to 0, passing COVERAGE=1 to run-multi-group.bash had no effect — the tester skipped coverage collection. Now checks both WITHGCOV and COVERAGE_MODE (which is passed into the container by run-tests-isolated.bash). Co-Authored-By: Claude Opus 4.6 (1M context) --- test/scripts/bin/proxysql-tester.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/scripts/bin/proxysql-tester.py b/test/scripts/bin/proxysql-tester.py index 50c15d828f..c6315f221b 100755 --- a/test/scripts/bin/proxysql-tester.py +++ b/test/scripts/bin/proxysql-tester.py @@ -1636,7 +1636,7 @@ def main(argv): log.debug(f"TEST_PY_TAP_SHUFFLE_LIMIT is disabled (current value: {shuffle_limit})") # Options - coverage = int(os.environ['WITHGCOV']) + coverage = int(os.environ.get('WITHGCOV', 0)) or int(os.environ.get('COVERAGE_MODE', 0)) for opt, arg in opts: if opt in ('-h', "--help"): From 879ebdc220b9fe779e393037e9cef62833b073af Mon Sep 17 00:00:00 2001 From: Rene Cannao Date: Mon, 23 Mar 2026 01:06:24 +0000 Subject: [PATCH 22/22] Fix startup order and add readiness check in test runner MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ensure-infras.bash: Move pre-proxysql hook (cluster setup) to run BEFORE backend infras start. Backends need ProxySQL and cluster to be fully ready because their docker-proxy-post.bash configures ProxySQL. Previous order was: ProxySQL → infras → cluster. New order: ProxySQL → cluster → infras (one by one) → setup hook. run-tests-isolated.bash: Add a readiness loop that waits up to 30s for ProxySQL admin port to be reachable from inside the test-runner container before running anything. Docker DNS resolution on newly created containers can take several seconds under load, causing "no route to host" (errno 113) errors on the first connection attempt. On failure, dumps DNS resolution diagnostics instead of silently proceeding. Co-Authored-By: Claude Opus 4.6 (1M context) --- test/infra/control/ensure-infras.bash | 49 ++++++++++------------ test/infra/control/run-tests-isolated.bash | 22 ++++++++++ 2 files changed, 45 insertions(+), 26 deletions(-) diff --git a/test/infra/control/ensure-infras.bash b/test/infra/control/ensure-infras.bash index b02ec5ee38..6dd07896b4 100755 --- a/test/infra/control/ensure-infras.bash +++ b/test/infra/control/ensure-infras.bash @@ -74,11 +74,29 @@ else echo ">>> ProxySQL is already running." fi -# 3. Ensure Docker Compose helper is available +# 3. Execute pre-proxysql hook (cluster setup) — BEFORE starting backends +# Backends need ProxySQL (and optionally the cluster) to be fully ready +# because their docker-proxy-post.bash configures ProxySQL. +PRE_PROXYSQL_HOOK="${WORKSPACE}/test/tap/groups/${TAP_GROUP}/pre-proxysql.bash" +if [ ! -f "${PRE_PROXYSQL_HOOK}" ]; then + PRE_PROXYSQL_HOOK="${WORKSPACE}/test/tap/groups/${BASE_GROUP}/pre-proxysql.bash" +fi +if [ ! -f "${PRE_PROXYSQL_HOOK}" ]; then + PRE_PROXYSQL_HOOK="${WORKSPACE}/test/tap/groups/default/pre-proxysql.bash" +fi + +if [ -f "${PRE_PROXYSQL_HOOK}" ]; then + echo ">>> Executing pre-proxysql hook: ${PRE_PROXYSQL_HOOK}" + "${PRE_PROXYSQL_HOOK}" +fi + +# 4. Ensure Docker Compose helper is available COMPOSE_CMD="docker compose" if ! $COMPOSE_CMD version &>/dev/null; then COMPOSE_CMD="docker-compose"; fi -# 4. Start Required Backends +# 5. Start Required Backends — one by one, sequentially +# Each backend's docker-compose-init.bash starts containers, waits for +# health, provisions users, and configures ProxySQL via docker-proxy-post.bash. for INFRA_NAME in ${INFRAS}; do INFRA_DIR="${WORKSPACE}/test/infra/${INFRA_NAME}" if [ ! -d "${INFRA_DIR}" ]; then @@ -88,8 +106,7 @@ for INFRA_NAME in ${INFRAS}; do COMPOSE_PROJECT="${INFRA_NAME}-${INFRA_ID}" echo ">>> Checking if backend '${INFRA_NAME}' (Project: ${COMPOSE_PROJECT}) is running..." - - # Check if ANY container for this project is running + if [ -z "$($COMPOSE_CMD -p "${COMPOSE_PROJECT}" ps -q 2>/dev/null)" ]; then echo ">>> '${INFRA_NAME}' is NOT running. Starting it now..." cd "${INFRA_DIR}" @@ -98,11 +115,10 @@ for INFRA_NAME in ${INFRAS}; do echo ">>> '${INFRA_NAME}' started successfully." else echo ">>> '${INFRA_NAME}' is already running." - # Run proxy post-configuration to ensure query rules are loaded if [ -f "${INFRA_DIR}/bin/docker-proxy-post.bash" ]; then echo ">>> Ensuring ProxySQL configuration for '${INFRA_NAME}'..." cd "${INFRA_DIR}" - ./bin/docker-proxy-post.bash || true + ./bin/docker-proxy-post.bash cd - >/dev/null fi fi @@ -110,8 +126,7 @@ done echo ">>> All required infrastructures for '${TAP_GROUP}' are READY (INFRA_ID: ${INFRA_ID})." -# 5. Derive DEFAULT_MYSQL_INFRA and DEFAULT_PGSQL_INFRA for hooks -# These are used by group-specific hooks to connect to backends +# 6. Derive DEFAULT_MYSQL_INFRA and DEFAULT_PGSQL_INFRA for hooks for INFRA_NAME in ${INFRAS}; do if [[ "${INFRA_NAME}" == *mysql* ]] || [[ "${INFRA_NAME}" == *mariadb* ]]; then export DEFAULT_MYSQL_INFRA="${DEFAULT_MYSQL_INFRA:-${INFRA_NAME}}" @@ -121,28 +136,10 @@ for INFRA_NAME in ${INFRAS}; do fi done -# 6. Execute pre-proxysql hook if it exists (for cluster setup) -# This starts additional ProxySQL cluster nodes if needed -PRE_PROXYSQL_HOOK="${WORKSPACE}/test/tap/groups/${TAP_GROUP}/pre-proxysql.bash" -if [ ! -f "${PRE_PROXYSQL_HOOK}" ]; then - # Try base group if subgroup doesn't have the hook - PRE_PROXYSQL_HOOK="${WORKSPACE}/test/tap/groups/${BASE_GROUP}/pre-proxysql.bash" -fi -# Fall back to default group if still not found -if [ ! -f "${PRE_PROXYSQL_HOOK}" ]; then - PRE_PROXYSQL_HOOK="${WORKSPACE}/test/tap/groups/default/pre-proxysql.bash" -fi - -if [ -f "${PRE_PROXYSQL_HOOK}" ]; then - echo ">>> Executing pre-proxysql hook: ${PRE_PROXYSQL_HOOK}" - "${PRE_PROXYSQL_HOOK}" -fi - # 7. Execute group-specific setup hook if it exists # This allows TAP groups to perform additional setup after all backends are running SETUP_HOOK="${WORKSPACE}/test/tap/groups/${TAP_GROUP}/setup-infras.bash" if [ ! -f "${SETUP_HOOK}" ]; then - # Try base group if subgroup doesn't have the hook SETUP_HOOK="${WORKSPACE}/test/tap/groups/${BASE_GROUP}/setup-infras.bash" fi diff --git a/test/infra/control/run-tests-isolated.bash b/test/infra/control/run-tests-isolated.bash index 920f793d76..45967dfa87 100755 --- a/test/infra/control/run-tests-isolated.bash +++ b/test/infra/control/run-tests-isolated.bash @@ -332,6 +332,28 @@ docker run \ # Source the local isolated environment (defaults for unset vars) source ${SCRIPT_DIR}/env-isolated.bash + # Wait for ProxySQL to be reachable from this container + # Docker DNS resolution can take a few seconds on newly created containers + echo -n '>>> Waiting for ProxySQL admin (proxysql:6032) ...' + WAIT_COUNT=0 + WAIT_MAX=30 + while [ \$WAIT_COUNT -lt \$WAIT_MAX ]; do + if mysql -uradmin -pradmin -hproxysql -P6032 -e 'SELECT 1' >/dev/null 2>&1; then + echo ' OK.' + break + fi + echo -n '.' + sleep 1 + WAIT_COUNT=\$((WAIT_COUNT + 1)) + done + if [ \$WAIT_COUNT -ge \$WAIT_MAX ]; then + echo ' FAILED after \${WAIT_MAX}s' + echo 'ERROR: Cannot reach ProxySQL admin from test-runner container.' + echo 'DNS resolution test:' + getent hosts proxysql || echo 'DNS lookup failed for proxysql' + exit 1 + fi + # Dump ProxySQL configuration before running tests echo '================================================================================' echo 'ProxySQL Configuration Dump (BEFORE TESTS)'