alby-hub/tests/db/postgres/docker-compose.yml
Roland 150d7bcc7a
Fix: postgres pay race condition (#1222)
* chore: add test for postgres race condition in transaction service

* fix: payments race condition when using postgres backend

* chore: reduce delay in concurrent payment tests
2025-03-25 17:31:19 +07:00

26 lines
1.1 KiB
YAML

# docker compose up
# connect with psql postgresql://postgres:password@localhost:5434
# TEST_DATABASE_URI="postgresql://postgres:password@localhost:5434" go test -timeout 30s -run ^TestHandleMultiPayInvoiceEvent_IsolatedApp_ConcurrentPayments$ github.com/getAlby/hub/nip47/controllers
# or
# TEST_DATABASE_URI="postgresql://postgres:password@localhost:5434" go test -timeout 30s -run ^TestHandleMultiPayKeysendEvent_IsolatedApp_ConcurrentPayments$ github.com/getAlby/hub/nip47/controllers
version: "3.6"
services:
pgtestdb:
image: postgres:15
environment:
POSTGRES_PASSWORD: password
restart: unless-stopped
volumes:
# Uses a tmpfs volume to make tests extremely fast. The data in test
# databases is not persisted across restarts, nor does it need to be.
- type: tmpfs
target: /var/lib/postgresql/data/
command:
- "postgres"
- "-c" # turn off fsync for speed
- "fsync=off"
- "-c" # log everything for debugging
- "log_statement=all"
ports:
# Entirely up to you what port you want to use while testing.
- "5434:5432"