From 00698f583166e6abbc3b8b945b34c5484ada6ce0 Mon Sep 17 00:00:00 2001 From: 7ttp <117663341+7ttp@users.noreply.github.com> Date: Tue, 20 Jan 2026 13:04:14 +0530 Subject: [PATCH 1/3] fix(db): set working directory for SQL relative imports --- internal/db/test/test.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/db/test/test.go b/internal/db/test/test.go index dadb44736..f2caea9a5 100644 --- a/internal/db/test/test.go +++ b/internal/db/test/test.go @@ -35,6 +35,7 @@ func Run(ctx context.Context, testFiles []string, config pgconn.Config, fsys afe } binds := make([]string, len(testFiles)) cmd := []string{"pg_prove", "--ext", ".pg", "--ext", ".sql", "-r"} + var workingDir string for i, fp := range testFiles { if !filepath.IsAbs(fp) { fp = filepath.Join(utils.CurrentDirAbs, fp) @@ -42,6 +43,9 @@ func Run(ctx context.Context, testFiles []string, config pgconn.Config, fsys afe dockerPath := utils.ToDockerPath(fp) cmd = append(cmd, dockerPath) binds[i] = fmt.Sprintf("%s:%s:ro", fp, dockerPath) + if workingDir == "" { + workingDir = filepath.Dir(dockerPath) + } } if viper.GetBool("DEBUG") { cmd = append(cmd, "--verbose") @@ -89,7 +93,8 @@ func Run(ctx context.Context, testFiles []string, config pgconn.Config, fsys afe "PGPASSWORD=" + config.Password, "PGDATABASE=" + config.Database, }, - Cmd: cmd, + Cmd: cmd, + WorkingDir: workingDir, }, hostConfig, network.NetworkingConfig{}, From 3364bd2b909194369db409f38cbcb936fc6ca633 Mon Sep 17 00:00:00 2001 From: Vaibhav <117663341+7ttp@users.noreply.github.com> Date: Tue, 20 Jan 2026 14:36:56 +0530 Subject: [PATCH 2/3] fix: handle directories and use path.Dir for unix separators Co-authored-by: Han Qiao --- internal/db/test/test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/db/test/test.go b/internal/db/test/test.go index f2caea9a5..faf16367c 100644 --- a/internal/db/test/test.go +++ b/internal/db/test/test.go @@ -44,7 +44,10 @@ func Run(ctx context.Context, testFiles []string, config pgconn.Config, fsys afe cmd = append(cmd, dockerPath) binds[i] = fmt.Sprintf("%s:%s:ro", fp, dockerPath) if workingDir == "" { - workingDir = filepath.Dir(dockerPath) + workingDir = dockerPath + if path.Ext(dockerPath) != "" { + workingDir = path.Dir(dockerPath) + } } } if viper.GetBool("DEBUG") { From 0ecc36eebb56aa1b5f2a9facf973425c3ed0db04 Mon Sep 17 00:00:00 2001 From: Vaibhav <117663341+7ttp@users.noreply.github.com> Date: Tue, 20 Jan 2026 15:25:40 +0530 Subject: [PATCH 3/3] import "path" --- internal/db/test/test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/db/test/test.go b/internal/db/test/test.go index faf16367c..2852ee943 100644 --- a/internal/db/test/test.go +++ b/internal/db/test/test.go @@ -5,6 +5,7 @@ import ( _ "embed" "fmt" "os" + "path" "path/filepath" "github.com/docker/docker/api/types/container"