From 26af8d80e60b5a43ba66dff94da93ad78378f4eb Mon Sep 17 00:00:00 2001 From: omer-topal Date: Thu, 7 May 2026 15:51:15 +0300 Subject: [PATCH] test: apply track_commit_timestamp via Cmd to skip postgres restart --- pkg/testinstance/postgres.go | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/pkg/testinstance/postgres.go b/pkg/testinstance/postgres.go index 3dc2fd2d3..440215a88 100644 --- a/pkg/testinstance/postgres.go +++ b/pkg/testinstance/postgres.go @@ -65,6 +65,7 @@ func PostgresDB(postgresVersion string) *PostgresInstance { Image: image, ExposedPorts: []string{"5432/tcp"}, Env: map[string]string{"POSTGRES_USER": "postgres", "POSTGRES_PASSWORD": "postgres", "POSTGRES_DB": "permify"}, + Cmd: []string{"postgres", "-c", "track_commit_timestamp=on"}, WaitingFor: wait.ForAll( wait.ForLog("database system is ready to accept connections"), wait.ForListeningPort("5432/tcp"), @@ -94,22 +95,6 @@ func PostgresDB(postgresVersion string) *PostgresInstance { gomega.Expect(err).ShouldNot(gomega.HaveOccurred()) } - // Execute the command in the container - _, _, execErr := postgres.Exec(ctx, []string{"psql", "-U", "postgres", "-c", "ALTER SYSTEM SET track_commit_timestamp = on;"}) - expectNoError(execErr) - - stopTimeout := 2 * time.Second - err = postgres.Stop(context.Background(), &stopTimeout) - expectNoError(err) - - err = postgres.Start(context.Background()) - expectNoError(err) - - cmd := []string{"sh", "-c", "export PGPASSWORD=postgres" + "; psql -U postgres -d permify -c 'DROP SCHEMA public CASCADE; CREATE SCHEMA public;'"} - - _, _, err = postgres.Exec(ctx, cmd) - expectNoError(err) - host, err := postgres.Host(ctx) expectNoError(err)