From 8705685f8367a69a98a210b00a880306d3fa6849 Mon Sep 17 00:00:00 2001 From: Rene Cannao Date: Mon, 23 Mar 2026 11:43:54 +0000 Subject: [PATCH] Address PR review comments: port collisions, gcov, loop bounds, fastcov - RESTAPI port offset changed from 6070+i to 7070+i to avoid collision with admin/mysql ports (6072 would collide with node4 admin) - Unset GCOV_PREFIX for background cluster nodes to prevent concurrent .gcda write corruption - Cap core-node and scheduler loops to min(NUM_NODES, 3) so smaller clusters don't reference non-existent nodes - TAP_CLUSTER_NODES now respects PROXYSQL_CLUSTER_NODES and SKIP_CLUSTER_START instead of hardcoding 9 - Fix fastcov flag: -i is invalid, use --include for source filtering --- test/infra/control/env-isolated.bash | 6 +++++- test/infra/control/run-tests-isolated.bash | 2 +- test/infra/control/start-proxysql-isolated.bash | 15 ++++++++++----- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/test/infra/control/env-isolated.bash b/test/infra/control/env-isolated.bash index b77f93ce7..33d2b241d 100755 --- a/test/infra/control/env-isolated.bash +++ b/test/infra/control/env-isolated.bash @@ -62,8 +62,12 @@ export TEST_DEPS="${TEST_DEPS_PATH}" # Cluster Nodes — all run inside the ProxySQL container on different ports # Port scheme: proxy-node1=6042, proxy-node2=6052, ..., proxy-node9=6122 # From the test-runner container, reach them via the proxysql hostname +NUM_CLUSTER_NODES=${PROXYSQL_CLUSTER_NODES:-9} +if [[ "${SKIP_CLUSTER_START}" == "1" ]] || [[ "${SKIP_CLUSTER_START}" == "true" ]]; then + NUM_CLUSTER_NODES=0 +fi CLUSTER_NODES="" -for i in $(seq 1 9); do +for i in $(seq 1 ${NUM_CLUSTER_NODES}); do PORT=$((6032 + i * 10)) CLUSTER_NODES="${CLUSTER_NODES}proxysql:${PORT}," done diff --git a/test/infra/control/run-tests-isolated.bash b/test/infra/control/run-tests-isolated.bash index feef6d954..39666fc3f 100755 --- a/test/infra/control/run-tests-isolated.bash +++ b/test/infra/control/run-tests-isolated.bash @@ -282,7 +282,7 @@ docker run \ echo \">>> Running fastcov on /gcov...\" cd /gcov fastcov -b -j\"\${nproc_val}\" --process-gcno -l \ - -i \"\${WORKSPACE}/include/\" \"\${WORKSPACE}/lib/\" \"\${WORKSPACE}/src/\" \"\${WORKSPACE}/test/\" \ + --include \"\${WORKSPACE}/include/\" \"\${WORKSPACE}/lib/\" \"\${WORKSPACE}/src/\" \"\${WORKSPACE}/test/\" \ -d . -o \"\${coverage_file}\" >> \"\${coverage_log}\" 2>&1 || echo \">>> WARNING: Coverage generation failed (see \${coverage_log})\" else echo \">>> WARNING: /gcov directory is empty or missing, skipping coverage\" diff --git a/test/infra/control/start-proxysql-isolated.bash b/test/infra/control/start-proxysql-isolated.bash index 20d12c42f..220c31d86 100755 --- a/test/infra/control/start-proxysql-isolated.bash +++ b/test/infra/control/start-proxysql-isolated.bash @@ -54,6 +54,9 @@ docker rm -f "${PROXY_CONTAINER}" >/dev/null 2>&1 || true # proxy-nodeN: admin=6032+(N*10), mysql=6033+(N*10) STARTUP_CMD=" +# Disable gcov for background cluster nodes to avoid concurrent .gcda writes +unset GCOV_PREFIX GCOV_PREFIX_STRIP + # Start cluster nodes as background processes for i in \$(seq 1 ${NUM_NODES}); do ADMIN_PORT=\$((6032 + i * 10)) @@ -147,9 +150,11 @@ if [ "${NUM_NODES}" -gt 0 ]; then MYSQL_CMD="docker exec -i ${PROXY_CONTAINER} mysql -uadmin -padmin -h127.0.0.1" - # Build proxysql_servers entries: primary + first 3 nodes as core + # Build proxysql_servers entries: primary + up to first 3 nodes as core + CORE_NODES=3 + if [ "${NUM_NODES}" -lt 3 ]; then CORE_NODES="${NUM_NODES}"; fi PROXYSQL_SERVERS_SQL="DELETE FROM proxysql_servers;" - for i in $(seq 1 3); do + for i in $(seq 1 "${CORE_NODES}"); do PORT=$((6032 + i * 10)) PROXYSQL_SERVERS_SQL="${PROXYSQL_SERVERS_SQL} INSERT INTO proxysql_servers (hostname,port,weight,comment) VALUES ('127.0.0.1',${PORT},0,'core-node${i}');" done @@ -170,7 +175,7 @@ SQL # Configure each node for i in $(seq 1 "${NUM_NODES}"); do ADMIN_PORT=$((6032 + i * 10)) - RESTAPI_PORT=$((6070 + i)) + RESTAPI_PORT=$((7070 + i)) echo ">>> Configuring proxy-node${i} (port ${ADMIN_PORT})" ${MYSQL_CMD} -P${ADMIN_PORT} <