Skip to content

Commit

Permalink
WIP: Try to remove PG GC flakes
Browse files Browse the repository at this point in the history
  • Loading branch information
josephschorr committed Nov 20, 2023
1 parent 57bf05e commit beb6d4d
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 30 deletions.
30 changes: 0 additions & 30 deletions internal/datastore/postgres/postgres_shared_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,6 @@ func testPostgresDatastore(t *testing.T, pc []postgresConfig) {
return ds, nil
}))

t.Run("GarbageCollection", createDatastoreTest(
b,
GarbageCollectionTest,
RevisionQuantization(0),
GCWindow(1*time.Millisecond),
GCInterval(veryLargeGCInterval),
WatchBufferLength(1),
MigrationPhase(config.migrationPhase),
))

t.Run("TransactionTimestamps", createDatastoreTest(
b,
TransactionTimestampsTest,
Expand All @@ -119,26 +109,6 @@ func testPostgresDatastore(t *testing.T, pc []postgresConfig) {
MigrationPhase(config.migrationPhase),
))

t.Run("GarbageCollectionByTime", createDatastoreTest(
b,
GarbageCollectionByTimeTest,
RevisionQuantization(0),
GCWindow(1*time.Millisecond),
GCInterval(veryLargeGCInterval),
WatchBufferLength(1),
MigrationPhase(config.migrationPhase),
))

t.Run("ChunkedGarbageCollection", createDatastoreTest(
b,
ChunkedGarbageCollectionTest,
RevisionQuantization(0),
GCWindow(1*time.Millisecond),
GCInterval(veryLargeGCInterval),
WatchBufferLength(1),
MigrationPhase(config.migrationPhase),
))

t.Run("QuantizedRevisions", func(t *testing.T) {
QuantizedRevisionTest(t, b)
})
Expand Down
48 changes: 48 additions & 0 deletions internal/datastore/postgres/postgres_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
package postgres

import (
"fmt"
"testing"
"time"

testdatastore "github.com/authzed/spicedb/internal/testserver/datastore"
)

func TestPostgresDatastore(t *testing.T) {
Expand All @@ -18,3 +22,47 @@ func TestPostgresDatastoreWithoutCommitTimestamps(t *testing.T) {

testPostgresDatastoreWithoutCommitTimestamps(t, postgresConfigs)
}

func TestPostgresDatastoreGC(t *testing.T) {
for _, config := range postgresConfigs {
pgbouncerStr := ""
if config.pgbouncer {
pgbouncerStr = "pgbouncer-"
}
t.Run(fmt.Sprintf("%spostgres-gc-%s-%s-%s", pgbouncerStr, config.pgVersion, config.targetMigration, config.migrationPhase), func(t *testing.T) {
t.Parallel()

b := testdatastore.RunPostgresForTesting(t, "", config.targetMigration, config.pgVersion, config.pgbouncer)

t.Run("GarbageCollection", createDatastoreTest(
b,
GarbageCollectionTest,
RevisionQuantization(0),
GCWindow(1*time.Millisecond),
GCInterval(veryLargeGCInterval),
WatchBufferLength(1),
MigrationPhase(config.migrationPhase),
))

t.Run("GarbageCollectionByTime", createDatastoreTest(
b,
GarbageCollectionByTimeTest,
RevisionQuantization(0),
GCWindow(1*time.Millisecond),
GCInterval(veryLargeGCInterval),
WatchBufferLength(1),
MigrationPhase(config.migrationPhase),
))

t.Run("ChunkedGarbageCollection", createDatastoreTest(
b,
ChunkedGarbageCollectionTest,
RevisionQuantization(0),
GCWindow(1*time.Millisecond),
GCInterval(veryLargeGCInterval),
WatchBufferLength(1),
MigrationPhase(config.migrationPhase),
))
})
}
}

0 comments on commit beb6d4d

Please sign in to comment.