Fix migration integration test for CI runner

Source DATABASE_URL from /home/cve-dashboard/backend/.env in test-backend job
so the integration test can connect to the local Postgres instance.

The test now skips gracefully via describe.skip when DATABASE_URL is unavailable
(defensive fallback), but with the env sourced it will run and validate migrations.
This commit is contained in:
Jordan Ramos
2026-05-26 11:22:39 -06:00
parent caf6ca4008
commit 7f6f458949
2 changed files with 40 additions and 5 deletions

View File

@@ -103,6 +103,9 @@ test-backend:
stage: test
script:
- npm ci --prefer-offline
# Source backend .env from the production install so DATABASE_URL is available
# for integration tests. Safe because the runner is on the same machine as the DB.
- set -a && source /home/cve-dashboard/backend/.env && set +a
- ./node_modules/.bin/jest --ci --forceExit backend/__tests__/
timeout: 5 minutes
needs: