testing the test database
Some checks failed
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Failing after 22s

This commit is contained in:
2025-11-21 19:19:39 -08:00
parent 59ace9b31e
commit 3952e26711
6 changed files with 72 additions and 2830 deletions

View File

@@ -60,35 +60,19 @@ jobs:
run: npm run lint # Run the linter to check for code quality issues.
continue-on-error: true # Allows the workflow to proceed even if linting fails.
- name: Setup Test Database
id: setup_test_db # Add an ID to reference this step's outcome later.
run: |
echo "--- Creating test database and user ---"
# Execute the setup script as the 'postgres' superuser.
# This creates the 'flyer-crawler-test' database and 'test_runner' role.
sudo -u postgres psql -f sql/test_setup.sql
- name: Run Unit Tests
# We override the production DB variables for this step only.
# The 'global-setup.ts' will use these to connect to the test database,
# create the schema, and seed data before tests run.
env:
DB_HOST: localhost
DB_PORT: 5432
DB_USER: test_runner
DB_PASSWORD: a_secure_test_password
DB_DATABASE: flyer-crawler-test
DB_HOST: ${{ secrets.DB_HOST }}
DB_PORT: ${{ secrets.DB_PORT }}
DB_USER: ${{ secrets.DB_USER }}
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
DB_DATABASE: "flyer-crawler-test" # Hardcode the test database name
run: npm test # Run the test suite against the temporary test database.
# also Run the test suite to ensure code correctness.
- name: Teardown Test Database
# This step runs regardless of whether the tests passed or failed.
# It will only execute if the 'setup_test_db' step was successful, preventing errors if setup failed.
if: always() && steps.setup_test_db.outcome == 'success'
run: |
echo "--- Dropping test database and user ---"
sudo -u postgres psql -f sql/test_teardown.sql
- name: Archive Code Coverage Report
# This action saves the generated HTML coverage report as a downloadable artifact.
uses: actions/upload-artifact@v3