From 615c9376ea946e3bb6f90d0eeeb29ab25480bcf1 Mon Sep 17 00:00:00 2001 From: Zbigniew Sobiecki Date: Sat, 14 Mar 2026 15:36:03 +0000 Subject: [PATCH] fix(setup): write TEST_DATABASE_URL to .cascade/env for worker containers 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 --- .cascade/setup.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.cascade/setup.sh b/.cascade/setup.sh index 0f9b1feb..1dcf6b3a 100755 --- a/.cascade/setup.sh +++ b/.cascade/setup.sh @@ -293,6 +293,17 @@ if pg_isready -q 2>/dev/null; then log_info "Running migrations on cascade_test..." DATABASE_URL="$TEST_DB_URL" DATABASE_SSL=false npm run db:migrate 2>&1 || \ log_warn "Migration failed on cascade_test - may need manual intervention" + + # Write TEST_DATABASE_URL to .cascade/env so resolveTestDbUrl() picks up the + # local postgres in worker containers where Docker is unavailable. + touch .cascade/env + if [ "$OS" = "macos" ]; then + sed -i '' '/^TEST_DATABASE_URL=/d' .cascade/env + else + sed -i '/^TEST_DATABASE_URL=/d' .cascade/env + fi + echo "TEST_DATABASE_URL=${TEST_DB_URL}" >> .cascade/env + log_info "Wrote TEST_DATABASE_URL to .cascade/env: ${TEST_DB_URL}" else log_warn "PostgreSQL not ready, skipping migrations" fi