From 2fff67166724798913fc0e35b300c68dcb1e0ca3 Mon Sep 17 00:00:00 2001 From: Alexis Viscogliosi Date: Sun, 19 May 2024 10:13:40 +0200 Subject: [PATCH] testutils: fix pg dump path --- .github/workflows/tests.yml | 4 +++- pkg/utils/testutils/snapshoting.go | 10 ++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0f23005..3a887dd 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -31,7 +31,9 @@ jobs: go-version: '1.22' - name: Setup pg_dump - run: sudo apt-get install postgresql-client + run: | + sudo apt-get install postgresql-client + which pg_dump - name: Wait for PostgreSQL to be ready run: | diff --git a/pkg/utils/testutils/snapshoting.go b/pkg/utils/testutils/snapshoting.go index ee3f584..2101907 100644 --- a/pkg/utils/testutils/snapshoting.go +++ b/pkg/utils/testutils/snapshoting.go @@ -140,7 +140,10 @@ func MaySnapshotSavePgDump(t TestingT, schemaName string, db schema.DatabaseCred env := map[string]string{"PGPASSWORD": db.Pass} - _, _, err = cmdexec.Exec(getPgDumpPath(), args, env) + _, stderr, err := cmdexec.Exec(getPgDumpPath(), args, env) + if err != nil { + fmt.Println(stderr) + } require.NoError(t, err) return @@ -168,7 +171,10 @@ func AssertSnapshotPgDumpDiff(t TestingT, schemaName string, db schema.DatabaseC env := map[string]string{"PGPASSWORD": db.Pass} - _, _, err := cmdexec.Exec(getPgDumpPath(), args, env) + _, stderr, err := cmdexec.Exec(getPgDumpPath(), args, env) + if err != nil { + fmt.Println(stderr) + } require.NoError(t, err) snap, err := os.ReadFile(fileSnap)