diff --git a/libs/checkpoint-postgres/Makefile b/libs/checkpoint-postgres/Makefile index b41e55257..33ed2a3c4 100644 --- a/libs/checkpoint-postgres/Makefile +++ b/libs/checkpoint-postgres/Makefile @@ -5,20 +5,33 @@ ###################### start-postgres: - docker compose -f tests/compose-postgres.yml up -V --force-recreate --wait + POSTGRES_VERSION=${POSTGRES_VERSION:-16} docker compose -f tests/compose-postgres.yml up -V --force-recreate --wait stop-postgres: docker compose -f tests/compose-postgres.yml down -test: - make start-postgres; \ - poetry run pytest; \ - EXIT_CODE=$$?; \ +POSTGRES_VERSIONS ?= 15 16 +test_pg_version: + @echo "Testing PostgreSQL $(POSTGRES_VERSION)" + @POSTGRES_VERSION=$(POSTGRES_VERSION) make start-postgres + @poetry run pytest $(TEST) + @EXIT_CODE=$$?; \ make stop-postgres; \ + echo "Finished testing PostgreSQL $(POSTGRES_VERSION); Exit code: $$EXIT_CODE"; \ exit $$EXIT_CODE + +test: + @for version in $(POSTGRES_VERSIONS); do \ + if ! make test_pg_version POSTGRES_VERSION=$$version; then \ + echo "Test failed for PostgreSQL $$version"; \ + exit 1; \ + fi; \ + done + @echo "All PostgreSQL versions tested successfully" + TEST ?= . test_watch: - make start-postgres; \ + POSTGRES_VERSION=${POSTGRES_VERSION:-16} make start-postgres; \ poetry run ptw $(TEST); \ EXIT_CODE=$$?; \ make stop-postgres; \ diff --git a/libs/checkpoint-postgres/tests/compose-postgres.yml b/libs/checkpoint-postgres/tests/compose-postgres.yml index 42d8c3781..a8a6c1e74 100644 --- a/libs/checkpoint-postgres/tests/compose-postgres.yml +++ b/libs/checkpoint-postgres/tests/compose-postgres.yml @@ -1,6 +1,6 @@ services: postgres-test: - image: postgres:16 + image: postgres:${POSTGRES_VERSION:-16} ports: - "5441:5432" environment: