# Security hardening: CSP, session revocation, and login fixes #310
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Backend Tests (Postgres) | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| - master | |
| push: | |
| branches: | |
| - main | |
| - master | |
| jobs: | |
| postgres-test: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| services: | |
| postgres: | |
| image: postgres:16 | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| POSTGRES_DB: efficientai_test | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd "pg_isready -U postgres -d efficientai_test" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 10 | |
| env: | |
| DATABASE_URL: postgresql://postgres:postgres@localhost:5432/efficientai_test | |
| TEST_DATABASE_URL: postgresql://postgres:postgres@localhost:5432/efficientai_test | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| POSTGRES_DB: efficientai_test | |
| POSTGRES_HOST: localhost | |
| POSTGRES_PORT: 5432 | |
| REDIS_URL: redis://localhost:6379/0 | |
| CELERY_BROKER_URL: redis://localhost:6379/0 | |
| CELERY_RESULT_BACKEND: redis://localhost:6379/0 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python and install dependencies | |
| uses: ./.github/actions/setup-python-deps | |
| - name: Run backend test suite on Postgres | |
| run: make test-parallel PYTEST_ARGS="--durations=25" | |
| db-sharding: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| services: | |
| postgres: | |
| image: postgres:16 | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| POSTGRES_DB: efficientai_test | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd "pg_isready -U postgres -d efficientai_test" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 10 | |
| env: | |
| PGHOST: localhost | |
| PGPORT: 5432 | |
| PGUSER: postgres | |
| PGPASSWORD: postgres | |
| DATABASE_URL: postgresql://postgres:postgres@localhost:5432/efficientai_catalog | |
| TEST_DATABASE_URL: postgresql://postgres:postgres@localhost:5432/efficientai_test | |
| CATALOG_DATABASE_URL: postgresql://postgres:postgres@localhost:5432/efficientai_catalog | |
| SHARD_DATABASE_URL_01: postgresql://postgres:postgres@localhost:5432/efficientai_data_01 | |
| SHARD_DATABASE_URL_02: postgresql://postgres:postgres@localhost:5432/efficientai_data_02 | |
| SHARDING_INTEGRATION_TEST: "1" | |
| REDIS_URL: redis://localhost:6379/0 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python and install dependencies | |
| uses: ./.github/actions/setup-python-deps | |
| - name: Create catalog and row-shard databases | |
| run: | | |
| for db in efficientai_catalog efficientai_data_01 efficientai_data_02; do | |
| psql -d postgres -v ON_ERROR_STOP=1 -c "DROP DATABASE IF EXISTS ${db};" | |
| psql -d postgres -v ON_ERROR_STOP=1 -c "CREATE DATABASE ${db};" | |
| done | |
| - name: Run db_sharding unit tests | |
| run: make test-sharding PYTEST_ARGS="--durations=10" | |
| - name: Run sharding Postgres integration tests | |
| run: make test-sharding-integration PYTEST_ARGS="--durations=10" |