Skip to content

Commit 65c4fe6

Browse files
committed
fix TC scripts directory resolution for GA
1 parent 554c818 commit 65c4fe6

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

internal/containers/localstack.go

+11-3
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,18 @@ func (c lsCustomizer) Customize(req *testcontainers.GenericContainerRequest) err
7474
}
7575

7676
func (c lsCustomizer) resolveDir(workingDir string) string {
77-
// trim everything after /pgx-outbox
78-
parts := strings.Split(workingDir, projectName)
77+
token := projectName + "/" + projectName
78+
79+
parts := strings.Split(workingDir, token)
7980
if len(parts) > 1 {
80-
workingDir = parts[0] + projectName
81+
// GitHub Actions case, i.e. /home/runner/work/pgx-outbox/pgx-outbox/writer_reader_test.go
82+
workingDir = parts[0] + token
83+
} else {
84+
// local machine case
85+
parts = strings.Split(workingDir, projectName)
86+
if len(parts) > 1 {
87+
workingDir = parts[0] + projectName
88+
}
8189
}
8290

8391
return fmt.Sprintf("%s/internal/containers/", workingDir)

internal/containers/postgres.go

+11-3
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,18 @@ func (c pgCustomizer) Customize(req *testcontainers.GenericContainerRequest) err
5959
}
6060

6161
func (c pgCustomizer) resolveDir(workingDir string) string {
62-
// trim everything after /pgx-outbox
63-
parts := strings.Split(workingDir, projectName)
62+
token := projectName + "/" + projectName
63+
64+
parts := strings.Split(workingDir, token)
6465
if len(parts) > 1 {
65-
workingDir = parts[0] + projectName
66+
// GitHub Actions case, i.e. /home/runner/work/pgx-outbox/pgx-outbox/writer_reader_test.go
67+
workingDir = parts[0] + token
68+
} else {
69+
// local machine case
70+
parts = strings.Split(workingDir, projectName)
71+
if len(parts) > 1 {
72+
workingDir = parts[0] + projectName
73+
}
6674
}
6775

6876
return fmt.Sprintf("%s/internal/sql/", workingDir)

0 commit comments

Comments
 (0)