Skip to content

Commit d71d0dc

Browse files
committed
fix(db): handle indented \ir and multi-directory test files
1 parent 3bb4f73 commit d71d0dc

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

internal/db/test/test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const (
2727
DISABLE_PGTAP = "drop extension if exists pgtap"
2828
)
2929

30-
var irPattern = regexp.MustCompile(`(?im)^\\ir\s+['"]?([^'"\s]+)['"]?`)
30+
var irPattern = regexp.MustCompile(`(?im)^\s*\\ir\s+['"]?([^'"\s]+)['"]?`)
3131

3232
func Run(ctx context.Context, testFiles []string, config pgconn.Config, fsys afero.Fs, options ...func(*pgx.ConnConfig)) error {
3333
// Build test command
@@ -58,7 +58,7 @@ func Run(ctx context.Context, testFiles []string, config pgconn.Config, fsys afe
5858
}
5959
if _, isTestFile := testFileSet[allFiles[i]]; isTestFile {
6060
relPath := dockerPath
61-
if path.Ext(dockerPath) != "" {
61+
if path.Ext(dockerPath) != "" && path.Dir(dockerPath) == workingDir {
6262
relPath = path.Base(dockerPath)
6363
}
6464
cmd = append(cmd, relPath)

0 commit comments

Comments
 (0)