Skip to content

fix(setup): write TEST_DATABASE_URL to .cascade/env for worker containers#828

Merged
zbigniewsobiecki merged 1 commit intodevfrom
fix/setup-test-database-url-env
Mar 14, 2026
Merged

fix(setup): write TEST_DATABASE_URL to .cascade/env for worker containers#828
zbigniewsobiecki merged 1 commit intodevfrom
fix/setup-test-database-url-env

Conversation

@zbigniewsobiecki
Copy link
Copy Markdown
Member

Summary

  • setup.sh now writes TEST_DATABASE_URL to .cascade/env after running migrations on cascade_test, so resolveTestDbUrl() picks up the local PostgreSQL instance in worker containers where Docker is unavailable
  • Fixes sed -i portability: macOS requires sed -i '' while Linux uses sed -i — now OS-branched consistently with the rest of the script
  • Replaces the if [ -f ] guard + mkdir -p with a single touch call (simpler, correct)

Root cause

Worker containers run setup.sh which installs local PostgreSQL and creates cascade_test, but never wrote TEST_DATABASE_URL to .cascade/env. resolveTestDbUrl() already handles this file as its second fallback (after the process env var), but the value was never there, so it fell through to the Docker Compose path — which fails with docker: not found in containers.

Test plan

  • Pre-push hook: all 306 unit + integration tests pass locally
  • npm run lint — clean
  • npm run typecheck — clean
  • Existing tests/unit/integration-helpers/db.test.ts fully covers the .cascade/env fallback path (no new tests needed for a shell-only change)

🤖 Generated with Claude Code

…ners

Worker containers run setup.sh which already installs local PostgreSQL
and creates cascade_test, but never wrote TEST_DATABASE_URL to .cascade/env.
resolveTestDbUrl() already reads that file as its second fallback, so
integration tests would fall through to the Docker Compose path (which
fails with 'docker: not found' in containers).

Also fixes sed -i portability: macOS requires 'sed -i ''' while Linux
uses 'sed -i'. Replaces the file-existence guard with a 'touch' to ensure
the file exists before the sed call.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@zbigniewsobiecki zbigniewsobiecki merged commit 12e7a68 into dev Mar 14, 2026
6 checks passed
@zbigniewsobiecki zbigniewsobiecki deleted the fix/setup-test-database-url-env branch March 14, 2026 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant