From 04df0346b7f6caf51b027a5b7e0a43a0d1e07ba9 Mon Sep 17 00:00:00 2001 From: Kevin De Porre Date: Wed, 11 Sep 2024 14:25:04 +0200 Subject: [PATCH] Also test configuration tests with PG 15 in CI. --- .github/workflows/elixir_tests.yml | 60 ++++++++++++++++++- .../tests/invalidated-replication-slot.lux | 2 +- .../replication-slot-invalidation.luxinc | 2 +- 3 files changed, 60 insertions(+), 4 deletions(-) diff --git a/.github/workflows/elixir_tests.yml b/.github/workflows/elixir_tests.yml index fc8798196a..d3280d344c 100644 --- a/.github/workflows/elixir_tests.yml +++ b/.github/workflows/elixir_tests.yml @@ -10,7 +10,7 @@ permissions: jobs: build: - name: Build and test + name: Build and test with PostgreSQL 14 runs-on: ubuntu-latest defaults: run: @@ -19,7 +19,7 @@ jobs: MIX_ENV: test services: postgres: - image: postgres:15-alpine + image: postgres:14-alpine env: POSTGRES_PASSWORD: password options: >- @@ -65,6 +65,62 @@ jobs: run: mix compile --force --all-warnings --warnings-as-errors - name: Run tests run: mix test + test_pg_15: + name: Build and test with PostgreSQL 15 + runs-on: ubuntu-latest + defaults: + run: + working-directory: packages/sync-service + env: + MIX_ENV: test + services: + postgres: + image: postgres:15-alpine + env: + POSTGRES_PASSWORD: password + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + - 54321:5432 + steps: + - uses: actions/checkout@v4 + - name: 'Set PG settings' + run: | + docker exec ${{ job.services.postgres.id }} sh -c 'echo "wal_level=logical" >> /var/lib/postgresql/data/postgresql.conf' + docker restart ${{ job.services.postgres.id }} + - uses: erlef/setup-beam@v1 + with: + version-type: strict + version-file: '.tool-versions' + - name: Restore dependencies cache + uses: actions/cache@v3 + with: + path: packages/sync-service/deps + key: ${{ runner.os }}-mix-${{ hashFiles('packages/sync-service/mix.lock') }} + restore-keys: ${{ runner.os }}-mix- + - name: Restore compiled code + uses: actions/cache/restore@v4 + with: + path: | + packages/sync-service/_build/*/lib + !packages/sync-service/_build/*/lib/electric + key: ${{ runner.os }}-build-test-${{ hashFiles('packages/sync-service/mix.lock') }} + - name: Install dependencies + run: mix deps.get && mix deps.compile + - name: Save compiled code + uses: actions/cache/save@v4 + with: + path: | + packages/sync-service/_build/*/lib + !packages/sync-service/_build/*/lib/electric + key: ${{ runner.os }}-build-test-${{ hashFiles('packages/sync-service/mix.lock') }} + - name: Compiles without warnings + run: mix compile --force --all-warnings --warnings-as-errors + - name: Run tests + run: mix test test/electric/postgres/configuration_test.exs formatting: name: Check formatting runs-on: ubuntu-latest diff --git a/integration-tests/tests/invalidated-replication-slot.lux b/integration-tests/tests/invalidated-replication-slot.lux index 0b19b93b09..e4ab4ee933 100644 --- a/integration-tests/tests/invalidated-replication-slot.lux +++ b/integration-tests/tests/invalidated-replication-slot.lux @@ -34,7 +34,7 @@ ## Confirm slot invalidation in Postgres. [shell pg] - ?invalidating slot "electric_slot" because its restart_lsn \d+/[a-zA-Z0-9]+ exceeds max_slot_wal_keep_size + ?invalidating slot "electric_slot" because its restart_lsn \d+/\d+ exceeds max_slot_wal_keep_size ## Observe the fatal connection error. [shell electric] diff --git a/integration-tests/tests/replication-slot-invalidation.luxinc b/integration-tests/tests/replication-slot-invalidation.luxinc index 4d987ab54c..2a1a52bcc4 100644 --- a/integration-tests/tests/replication-slot-invalidation.luxinc +++ b/integration-tests/tests/replication-slot-invalidation.luxinc @@ -15,7 +15,7 @@ -e POSTGRES_PASSWORD=password \ -e POSTGRES_INITDB_ARGS=${initdb_args} \ -p 5432 \ - postgres:15-alpine \ + postgres:14-alpine \ -c wal_level=logical ${config_opts} ??database system is ready to accept connections