Skip to content

Commit 4d01a50

Browse files
committed
always use local Transact to build the CLI test application
1 parent 928b002 commit 4d01a50

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

cmd/dbos/cli_integration_test.go

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,25 @@ func testProjectInitialization(t *testing.T, cliPath string) {
192192
err = os.WriteFile(mainGoPath, testAppContent, 0644)
193193
require.NoError(t, err, "Failed to write test app to main.go")
194194

195-
// Run go mod tidy to prepare for build
195+
// Replace the go.mod to use the local dbos directory
196196
err = os.Chdir(projectDir)
197197
require.NoError(t, err)
198198

199+
// Get the absolute path to the dbos-transact-golang repository root
200+
// We need to find the actual repository location, not the temp test directory
201+
_, filename, _, ok := runtime.Caller(0)
202+
require.True(t, ok, "Failed to get current file path")
203+
204+
// Navigate from cmd/dbos/cli_integration_test.go to the repo root
205+
repoRoot := filepath.Dir(filepath.Dir(filepath.Dir(filename)))
206+
207+
// Use go mod edit to replace the dependency with the local path
208+
replaceCmd := exec.Command("go", "mod", "edit", "-replace",
209+
fmt.Sprintf("github.com/dbos-inc/dbos-transact-golang=%s", repoRoot))
210+
replaceOutput, err := replaceCmd.CombinedOutput()
211+
require.NoError(t, err, "go mod edit -replace failed: %s", string(replaceOutput))
212+
213+
// Run go mod tidy to prepare for build
199214
modCmd := exec.Command("go", "mod", "tidy")
200215
modOutput, err := modCmd.CombinedOutput()
201216
require.NoError(t, err, "go mod tidy failed: %s", string(modOutput))

0 commit comments

Comments
 (0)