From 93c2279b04844f8232e328975868c2b2c82eb83c Mon Sep 17 00:00:00 2001 From: Miguel Martinez Trivino Date: Sun, 18 Oct 2026 00:50:47 +0200 Subject: [PATCH] test(controlplane): turn off postgres durability in the test container The integration test database is disposable, so start it with fsync, synchronous_commit and full_page_writes off and keep its data directory on tmpfs. This makes the control plane test suite run faster. Closes #3645 Assisted-by: Claude Code Signed-off-by: Miguel Martinez Trivino Chainloop-Trace-Sessions: 3a3863d9-a0d3-432b-9ce7-eb6c74404598 --- app/controlplane/pkg/biz/testhelpers/database.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/controlplane/pkg/biz/testhelpers/database.go b/app/controlplane/pkg/biz/testhelpers/database.go index acab54066..d6dbfb36b 100644 --- a/app/controlplane/pkg/biz/testhelpers/database.go +++ b/app/controlplane/pkg/biz/testhelpers/database.go @@ -182,6 +182,15 @@ func NewTestDatabase(t *testing.T) *TestDatabase { "POSTGRES_PASSWORD": "postgres", "POSTGRES_DB": "controlplane_test", }, + // The database is disposable, so trade durability for speed. + // Never use these settings outside of tests. + Cmd: []string{ + "postgres", + "-c", "fsync=off", + "-c", "synchronous_commit=off", + "-c", "full_page_writes=off", + }, + Tmpfs: map[string]string{"/var/lib/postgresql/data": "rw"}, WaitingFor: wait.ForSQL(port, "postgres", dbURL).WithStartupTimeout(time.Second * 5), }