From b19123e6f20ef3b79dd6db05a0f55d0ab62c404c Mon Sep 17 00:00:00 2001 From: perf3ct Date: Thu, 19 Jun 2025 21:56:00 +0000 Subject: [PATCH] feat(tests): enable RUST_BACKTRACE on all tests, for debugging --- .github/workflows/test-e2e.yml | 4 ++++ .github/workflows/test-integration.yml | 1 + .github/workflows/test-unit.yml | 2 ++ docker-compose.test.yml | 1 + run-tests.sh | 2 ++ 5 files changed, 10 insertions(+) diff --git a/.github/workflows/test-e2e.yml b/.github/workflows/test-e2e.yml index 97bd6b8..7c3f6b6 100644 --- a/.github/workflows/test-e2e.yml +++ b/.github/workflows/test-e2e.yml @@ -74,6 +74,7 @@ jobs: run: cargo build --release env: DATABASE_URL: postgres://postgres:postgres@localhost:5432/readur_test + RUST_BACKTRACE: 1 - name: Build frontend working-directory: ./frontend @@ -92,6 +93,7 @@ jobs: FRONTEND_PATH: ./frontend/dist UPLOAD_PATH: ./uploads WATCH_PATH: ./watch + RUST_BACKTRACE: 1 - name: Wait for backend to be ready run: | @@ -104,6 +106,7 @@ jobs: sleep 2 done + - name: Install Playwright browsers working-directory: ./frontend run: npx playwright install --with-deps @@ -113,6 +116,7 @@ jobs: run: npm run test:e2e env: VITE_API_URL: http://localhost:8000 + PLAYWRIGHT_BASE_URL: http://localhost:8000 - name: Stop backend server if: always() diff --git a/.github/workflows/test-integration.yml b/.github/workflows/test-integration.yml index 2a14d67..5c9f41e 100644 --- a/.github/workflows/test-integration.yml +++ b/.github/workflows/test-integration.yml @@ -109,6 +109,7 @@ jobs: DATABASE_URL: ${{ env.DATABASE_URL }} TEST_DATABASE_URL: ${{ env.DATABASE_URL }} RUST_LOG: debug + RUST_BACKTRACE: 1 - name: Stop readur server if: always() diff --git a/.github/workflows/test-unit.yml b/.github/workflows/test-unit.yml index f9aaf1a..4e29ee0 100644 --- a/.github/workflows/test-unit.yml +++ b/.github/workflows/test-unit.yml @@ -53,6 +53,8 @@ jobs: run: | cargo test --lib cargo test --tests unit_tests + env: + RUST_BACKTRACE: 1 frontend-unit-tests: runs-on: ubuntu-latest diff --git a/docker-compose.test.yml b/docker-compose.test.yml index 78b26df..22f1eb3 100644 --- a/docker-compose.test.yml +++ b/docker-compose.test.yml @@ -58,6 +58,7 @@ services: # Test-specific environment variables RUST_LOG: debug + RUST_BACKTRACE: 1 TEST_ENV: true ports: diff --git a/run-tests.sh b/run-tests.sh index 6861de4..dddb557 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -185,6 +185,7 @@ run_unit_tests() { local exit_code output=$(DATABASE_URL="postgresql://readur_test:readur_test@localhost:5433/readur_test" \ + RUST_BACKTRACE=1 \ cargo test --lib --no-fail-fast 2>&1) exit_code=$? @@ -217,6 +218,7 @@ run_integration_tests() { DATABASE_URL="postgresql://readur_test:readur_test@localhost:5433/readur_test" \ TEST_DATABASE_URL="postgresql://readur_test:readur_test@localhost:5433/readur_test" \ API_URL="http://localhost:8001" \ + RUST_BACKTRACE=1 \ cargo test --test '*' --no-fail-fast 2>&1 | tee "$output_file" exit_code=${PIPESTATUS[0]}