From 6c0da426c67f4dfb49fb7bfdfcc2893852b0b9c4 Mon Sep 17 00:00:00 2001 From: William FH <13333726+hinthornw@users.noreply.github.com> Date: Wed, 2 Oct 2024 12:16:58 -0700 Subject: [PATCH] [PostGres Checkpointer] Run CI on PG15 as well (#1953) --- libs/checkpoint-postgres/Makefile | 25 ++++++++++++++----- .../tests/compose-postgres.yml | 2 +- 2 files changed, 20 insertions(+), 7 deletions(-) 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: