mirror of
https://github.com/supabase/supabase.git
synced 2026-05-08 07:50:20 +08:00
## I have read the [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file. YES ## What kind of change does this PR introduce? Refactor of the pg-meta test setup scripts. ## What is the current behavior? The test command runs multiple sequential npm-run-s scripts (`db:clean`, `db:run`, `test:run`, `db:clean`) with a hardcoded port 5432, causing container name and port collisions when running tests across multiple git worktrees in parallel. ## What is the new behavior? A single `test/run-tests.sh` wrapper script handles the full test lifecycle: it finds an available port dynamically (scanning 5432–5531), sets a unique Docker Compose project name based on a hash of the package directory path, starts the DB, runs the test command, and tears down on exit. This allows pg-meta tests to run in parallel across multiple worktrees without conflicts. ## Additional context <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Streamlined test execution to centralize setup and teardown for reliable runs. * Made the test database port configurable with automatic local port discovery and fail-fast behavior. * Created isolated test environments per workspace to avoid container/name collisions and improve cleanup. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
17 lines
498 B
YAML
Executable File
17 lines
498 B
YAML
Executable File
services:
|
|
db:
|
|
build: .
|
|
ports:
|
|
- ${PG_TEST_PORT:-5432}:5432
|
|
volumes:
|
|
- .:/docker-entrypoint-initdb.d
|
|
environment:
|
|
POSTGRES_PASSWORD: postgres
|
|
command: postgres -c config_file=/etc/postgresql/postgresql.conf -c ssl=on -c ssl_cert_file=/var/lib/postgresql/server.crt -c ssl_key_file=/var/lib/postgresql/server.key
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
|
interval: 1s
|
|
timeout: 2s
|
|
retries: 10
|
|
start_period: 2s
|