Skip to content

Commit

Permalink
Switch postgres tests to run in a matrix of versions
Browse files Browse the repository at this point in the history
  • Loading branch information
josephschorr committed Jan 8, 2025
1 parent c18b165 commit 61c6476
Show file tree
Hide file tree
Showing 8 changed files with 369 additions and 297 deletions.
33 changes: 32 additions & 1 deletion .github/workflows/build-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ jobs:
strategy:
fail-fast: false
matrix:
datastore: ["crdb", "mysql", "postgres", "spanner", "pgbouncer"]
datastore: ["crdb", "mysql", "spanner"]
steps:
- uses: "actions/checkout@v4"
if: |
Expand All @@ -130,6 +130,37 @@ jobs:
needs.paths-filter.outputs.codechange == 'true'
run: "go run mage.go testcons:${{ matrix.datastore }}"

pgdatastore:
name: "Postgres Datastore Tests"
runs-on: "buildjet-4vcpu-ubuntu-2204"
needs: "paths-filter"
strategy:
fail-fast: false
matrix:
datastore: ["postgres", "pgbouncer"]
pgversion: ["13.8", "14", "15", "16", "17"]
steps:
- uses: "actions/checkout@v4"
if: |
needs.paths-filter.outputs.codechange == 'true'
- uses: "authzed/actions/setup-go@main"
if: |
needs.paths-filter.outputs.codechange == 'true'
- uses: "docker/login-action@v3"
if: |
needs.paths-filter.outputs.codechange == 'true'
with:
username: "${{ env.DOCKERHUB_PUBLIC_USER }}"
password: "${{ env.DOCKERHUB_PUBLIC_ACCESS_TOKEN }}"
- name: "Integration tests"
if: |
needs.paths-filter.outputs.codechange == 'true'
run: "go run mage.go testds:${{ matrix.datastore }} ${{ matrix.pgversion }}"
- name: "Consistency tests"
if: |
needs.paths-filter.outputs.codechange == 'true'
run: "go run mage.go testcons:${{ matrix.datastore }} ${{ matrix.pgversion }}"

e2e:
name: "E2E"
runs-on: "buildjet-8vcpu-ubuntu-2204"
Expand Down
15 changes: 3 additions & 12 deletions internal/datastore/postgres/pgbouncer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,14 @@ package postgres

import (
"testing"

pgversion "github.com/authzed/spicedb/internal/datastore/postgres/version"

"github.com/samber/lo"
)

var pgbouncerConfigs = lo.Map(
[]string{pgversion.MinimumSupportedPostgresVersion, "14", "15", "16"},
func(postgresVersion string, _ int) postgresConfig {
return postgresConfig{"head", "", postgresVersion, true}
},
)
var pgbouncerConfig = postgresTestConfig{"head", "", postgresTestVersion(), true}

func TestPostgresWithPgBouncerDatastore(t *testing.T) {
testPostgresDatastore(t, pgbouncerConfigs)
testPostgresDatastore(t, pgbouncerConfig)
}

func TestPostgresDatastoreWithPgBouncerWithoutCommitTimestamps(t *testing.T) {
testPostgresDatastoreWithoutCommitTimestamps(t, pgbouncerConfigs)
testPostgresDatastoreWithoutCommitTimestamps(t, pgbouncerConfig)
}
Loading

0 comments on commit 61c6476

Please sign in to comment.