From 1fabe65f2f782401591596753d375adbf3e6c062 Mon Sep 17 00:00:00 2001 From: konrad Date: Tue, 10 Nov 2026 13:39:03 +0100 Subject: [PATCH] [TT-18717] Pass the Postgres MCP analytics DSN to API tests Without TYK_TEST_MCP_POSTGRES_DSN the MCP analytics tests read raw records from Mongo, so on Postgres environments they find nothing. Needs the tyk-pro release with the unsharded raw sql-mcp pump (tyk-pro#115). Co-Authored-By: Claude Opus 5.5 --- .github/actions/tests/api-tests/action.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/actions/tests/api-tests/action.yaml b/.github/actions/tests/api-tests/action.yaml index 04b0b2c1..a7ea4a34 100644 --- a/.github/actions/tests/api-tests/action.yaml +++ b/.github/actions/tests/api-tests/action.yaml @@ -9,6 +9,10 @@ inputs: description: 'Markers to filter tests' required: false default: ${{ matrix.envfiles.apimarkers }} + db: + description: 'Database of the test environment, e.g. postgres15 or mongo7' + required: false + default: ${{ matrix.envfiles.db }} runs: using: "composite" steps: @@ -24,6 +28,7 @@ runs: env: USER_API_SECRET: ${{ inputs.user_api_secret }} API_MARKERS: ${{ inputs.api_markers }} + DB: ${{ inputs.db }} run: | pip install --no-deps -r requirements.txt cat >pytest.env <<-EOF @@ -44,4 +49,9 @@ runs: TYK_TEST_KEYCLOAK_URL=http://localhost:8180 TYK_TEST_KEYCLOAK_INTERNAL_URL=http://keycloak:8080 EOF + # MCP analytics tests read raw records from Postgres when given a DSN, otherwise from Mongo. + # URL form: the line below splits pytest.env on whitespace. + if [[ "$DB" == postgres* ]]; then + echo "TYK_TEST_MCP_POSTGRES_DSN=postgresql://postgres@localhost:5432/tyk_analytics?sslmode=disable" >> pytest.env + fi env $(cat pytest.env | xargs) pytest -c pytest_ci.ini --ci --junitxml=${XUNIT_REPORT_PATH} -m "${{ inputs.api_markers }}"