From 3a8be92acca4a5a9377244de5946491df505e292 Mon Sep 17 00:00:00 2001 From: Griatch Date: Sat, 14 Feb 2026 19:39:12 +0100 Subject: [PATCH] CI: Trying to analyze Psql CI fails --- .github/actions/run-tests/action.yml | 8 +++++++- .github/workflows/github_action_test_suite.yml | 8 ++++++++ .github/workflows/postgresql_settings.py | 13 ++++++++++++- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/.github/actions/run-tests/action.yml b/.github/actions/run-tests/action.yml index beffa0003b..1c78e3a4ff 100644 --- a/.github/actions/run-tests/action.yml +++ b/.github/actions/run-tests/action.yml @@ -102,7 +102,13 @@ runs: if: ${{ inputs.coverage-test != 'true' }} working-directory: testing_mygame run: | - evennia test --settings=settings --keepdb --timing evennia + if [ "${{ inputs.testing-db }}" = "postgresql" ]; then + # PostgreSQL runs in CI have historically been sensitive to reusing + # stale test DB state; run with explicit verbosity for easier diagnosis. + evennia test --settings=settings --timing -v 2 evennia + else + evennia test --settings=settings --keepdb --timing evennia + fi shell: bash # OBS - it's important to not run the coverage tests with --parallel, it messes up the coverage diff --git a/.github/workflows/github_action_test_suite.yml b/.github/workflows/github_action_test_suite.yml index d0b20eaff6..a7a38c0d99 100644 --- a/.github/workflows/github_action_test_suite.yml +++ b/.github/workflows/github_action_test_suite.yml @@ -138,6 +138,14 @@ jobs: needs-postgres-package: "true" needs-mysql-package: "false" + - name: PostgreSQL diagnostics on failure + if: ${{ failure() }} + env: + PGPASSWORD: password + run: | + psql -h localhost -U evennia -d evennia -c "SELECT now() as ts, pid, usename, state, wait_event_type, wait_event, xact_start, query_start, LEFT(query, 240) AS query FROM pg_stat_activity ORDER BY query_start NULLS LAST;" + psql -h localhost -U evennia -d evennia -c "SELECT blocked_locks.pid AS blocked_pid, blocking_locks.pid AS blocking_pid, blocked_activity.usename AS blocked_user, blocking_activity.usename AS blocking_user, LEFT(blocked_activity.query, 160) AS blocked_query, LEFT(blocking_activity.query, 160) AS blocking_query FROM pg_locks blocked_locks JOIN pg_stat_activity blocked_activity ON blocked_activity.pid = blocked_locks.pid JOIN pg_locks blocking_locks ON blocking_locks.locktype = blocked_locks.locktype AND blocking_locks.database IS NOT DISTINCT FROM blocked_locks.database AND blocking_locks.relation IS NOT DISTINCT FROM blocked_locks.relation AND blocking_locks.page IS NOT DISTINCT FROM blocked_locks.page AND blocking_locks.tuple IS NOT DISTINCT FROM blocked_locks.tuple AND blocking_locks.virtualxid IS NOT DISTINCT FROM blocked_locks.virtualxid AND blocking_locks.transactionid IS NOT DISTINCT FROM blocked_locks.transactionid AND blocking_locks.classid IS NOT DISTINCT FROM blocked_locks.classid AND blocking_locks.objid IS NOT DISTINCT FROM blocked_locks.objid AND blocking_locks.objsubid IS NOT DISTINCT FROM blocked_locks.objsubid AND blocking_locks.pid != blocked_locks.pid JOIN pg_stat_activity blocking_activity ON blocking_activity.pid = blocking_locks.pid WHERE NOT blocked_locks.granted;" + deploy: name: Deploy Docker Image needs: [test-sqlite, test-mysql, test-postgresql] diff --git a/.github/workflows/postgresql_settings.py b/.github/workflows/postgresql_settings.py index c12927af3a..c1148e64e1 100644 --- a/.github/workflows/postgresql_settings.py +++ b/.github/workflows/postgresql_settings.py @@ -46,7 +46,18 @@ DATABASES = { "PASSWORD": "password", "HOST": "localhost", "PORT": "", # use default - "TEST": {"NAME": "default"}, + # Fail fast in CI if queries block or run unreasonably long so hangs + # produce actionable errors instead of job-level timeout cancellations. + "OPTIONS": { + "options": ( + "-c lock_timeout=30000 " + "-c statement_timeout=300000 " + "-c idle_in_transaction_session_timeout=60000" + ) + }, + # Keep this explicit and distinct from the default alias/database to avoid + # any ambiguity when using Django's test runner in CI. + "TEST": {"NAME": "test_evennia"}, } }