diff --git a/test/infra/README.md b/test/infra/README.md index f0d40c7df..9fb0497d8 100644 --- a/test/infra/README.md +++ b/test/infra/README.md @@ -75,7 +75,7 @@ Every TAP test group (in `test/tap/groups/`) can define its required * **Who reads it?**: `test/infra/control/run-tests-isolated.bash` on the host. * **Verification**: The script checks if ProxySQL (`proxysql.${INFRA_ID}`) and all project-prefixed backend containers (e.g. `infra-mysql57-${INFRA_ID}-mysql1-1`) are active. -* **Safety**: If a required infrastructure is missing, the test runner **fails immediately** to prevent unverified test results. +* **Safety**: If a required infrastructure is missing, the test runner **fails immediately**. It outputs an explicit error message identifying the missing infrastructure and referencing the `infras.lst` file that defined the requirement. ### Orchestration Roles 1. **Infrastructure Initialization**: Handled by the user or a wrapper. Responsible for container health and ProxySQL registration. diff --git a/test/infra/control/run-tests-isolated.bash b/test/infra/control/run-tests-isolated.bash index d6da19090..22af425c6 100755 --- a/test/infra/control/run-tests-isolated.bash +++ b/test/infra/control/run-tests-isolated.bash @@ -51,8 +51,12 @@ for INFRA_NAME in ${INFRAS_TO_CHECK}; do # Get all services for this project RUNNING_CONTAINERS=$(docker ps --filter "label=com.docker.compose.project=${COMPOSE_PROJECT}" --format '{{.Names}}') if [ -z "${RUNNING_CONTAINERS}" ]; then - echo "ERROR: No containers found for infrastructure project: ${COMPOSE_PROJECT}" - echo "Please run initialization for ${INFRA_NAME} first." + LST_PATH="${WORKSPACE}/test/tap/groups/${TAP_GROUP}/infras.lst" + echo "ERROR: Required infrastructure '${INFRA_NAME}' is NOT running." + if [ -f "${LST_PATH}" ]; then + echo "According to '${LST_PATH}', this infrastructure is mandatory for the '${TAP_GROUP}' group." + fi + echo "Please run initialization for '${INFRA_NAME}' first (e.g. cd test/infra/${INFRA_NAME} && ./docker-compose-init.bash)." exit 1 fi echo "Found running containers: ${RUNNING_CONTAINERS//$'\n'/ }" @@ -98,6 +102,9 @@ docker run \ set -e git config --global --add safe.directory \"${WORKSPACE}\" + # Redirection: Replace reference to legacy scripts with local infra control scripts + find \"${WORKSPACE}/test/tap/groups\" -name \"*.bash\" | xargs -r sed -i \"s|\\\$JENKINS_SCRIPTS_PATH|${WORKSPACE}/test/infra/control|g\" + # Cleanup legacy .env files inside container view find \"${WORKSPACE}/test/tap/tests\" -name \".env\" -o -name \"tests.env\" | while read f; do sed -i '/TAP_ROOT/d' \"\$f\"