github.com/authzed/spicedb@v1.32.1-0.20240520085336-ebda56537386/internal/datastore/postgres/postgres_test.go (about) 1 //go:build ci && docker && postgres 2 // +build ci,docker,postgres 3 4 package postgres 5 6 import ( 7 "fmt" 8 "testing" 9 "time" 10 11 testdatastore "github.com/authzed/spicedb/internal/testserver/datastore" 12 ) 13 14 func TestPostgresDatastore(t *testing.T) { 15 t.Parallel() 16 17 testPostgresDatastore(t, postgresConfigs) 18 } 19 20 func TestPostgresDatastoreWithoutCommitTimestamps(t *testing.T) { 21 t.Parallel() 22 23 testPostgresDatastoreWithoutCommitTimestamps(t, postgresConfigs) 24 } 25 26 func TestPostgresDatastoreGC(t *testing.T) { 27 for _, config := range postgresConfigs { 28 pgbouncerStr := "" 29 if config.pgbouncer { 30 pgbouncerStr = "pgbouncer-" 31 } 32 t.Run(fmt.Sprintf("%spostgres-gc-%s-%s-%s", pgbouncerStr, config.pgVersion, config.targetMigration, config.migrationPhase), func(t *testing.T) { 33 t.Parallel() 34 35 b := testdatastore.RunPostgresForTesting(t, "", config.targetMigration, config.pgVersion, config.pgbouncer) 36 37 t.Run("GarbageCollection", createDatastoreTest( 38 b, 39 GarbageCollectionTest, 40 RevisionQuantization(0), 41 GCWindow(1*time.Millisecond), 42 GCInterval(veryLargeGCInterval), 43 WatchBufferLength(1), 44 MigrationPhase(config.migrationPhase), 45 )) 46 47 t.Run("GarbageCollectionByTime", createDatastoreTest( 48 b, 49 GarbageCollectionByTimeTest, 50 RevisionQuantization(0), 51 GCWindow(1*time.Millisecond), 52 GCInterval(veryLargeGCInterval), 53 WatchBufferLength(1), 54 MigrationPhase(config.migrationPhase), 55 )) 56 57 t.Run("ChunkedGarbageCollection", createDatastoreTest( 58 b, 59 ChunkedGarbageCollectionTest, 60 RevisionQuantization(0), 61 GCWindow(1*time.Millisecond), 62 GCInterval(veryLargeGCInterval), 63 WatchBufferLength(1), 64 MigrationPhase(config.migrationPhase), 65 )) 66 }) 67 } 68 }