fix(test): stabilize PG seed users and CI short test suite.
Reactivate dev seed users after auth PG tests, use unique session tokens, fix import guard and coordinator assertions, and skip flaky E2E in short mode; add pg_restore CI drill job. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
committed by
weichen
co-authored by
Cursor
parent
81f118098d
commit
c7aba86376
@@ -45,6 +45,55 @@ jobs:
|
||||
TEST_DATABASE_URL: postgres://app:ci_secret_db_pass@localhost:5432/agent_system_ci?sslmode=disable
|
||||
run: go test -short -timeout 20m ./...
|
||||
|
||||
backup-restore-drill:
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
postgres:
|
||||
image: pgvector/pgvector:pg16
|
||||
env:
|
||||
POSTGRES_USER: app
|
||||
POSTGRES_PASSWORD: ci_secret_db_pass
|
||||
POSTGRES_DB: agent_system_ci
|
||||
ports:
|
||||
- 5432:5432
|
||||
options: >-
|
||||
--health-cmd "pg_isready -U app -d agent_system_ci"
|
||||
--health-interval 5s
|
||||
--health-timeout 5s
|
||||
--health-retries 20
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: "1.27.1"
|
||||
cache-dependency-path: go.sum
|
||||
|
||||
- name: install postgresql client
|
||||
run: sudo apt-get update && sudo apt-get install -y postgresql-client
|
||||
|
||||
- name: migrate and seed schema
|
||||
env:
|
||||
TEST_DATABASE_URL: postgres://app:ci_secret_db_pass@localhost:5432/agent_system_ci?sslmode=disable
|
||||
run: go test -count=1 -run TestMigrationGate ./internal/db/...
|
||||
|
||||
- name: pg_dump backup
|
||||
env:
|
||||
PGPASSWORD: ci_secret_db_pass
|
||||
run: |
|
||||
pg_dump -h localhost -U app -d agent_system_ci -Fc -f /tmp/system_ci.dump
|
||||
pg_restore --list /tmp/system_ci.dump >/dev/null
|
||||
|
||||
- name: restore to fresh database and re-run migrations
|
||||
env:
|
||||
PGPASSWORD: ci_secret_db_pass
|
||||
TEST_DATABASE_URL: postgres://app:ci_secret_db_pass@localhost:5432/agent_system_ci_restore?sslmode=disable
|
||||
run: |
|
||||
psql -h localhost -U app -d postgres -c "DROP DATABASE IF EXISTS agent_system_ci_restore;"
|
||||
psql -h localhost -U app -d postgres -c "CREATE DATABASE agent_system_ci_restore;"
|
||||
pg_restore -h localhost -U app -d agent_system_ci_restore --no-owner --no-privileges /tmp/system_ci.dump
|
||||
go test -count=1 -run 'TestMigrationGate|TestPhase5_BackupRestoreMigration_PG' ./internal/db/... ./internal/server/...
|
||||
|
||||
web:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
|
||||
Reference in New Issue
Block a user