Skip to content

Commit 3fe94af

Browse files
ci: fix ci
1 parent 46d9bc3 commit 3fe94af

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

e2e_tests/boundary_integration_test.go

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,36 @@ import (
44
"context"
55
"os"
66
"os/exec"
7+
"path/filepath"
78
"strings"
89
"testing"
910
"time"
1011

1112
"github.com/stretchr/testify/require"
1213
)
1314

15+
// findProjectRoot finds the project root by looking for go.mod file
16+
func findProjectRoot(t *testing.T) string {
17+
cwd, err := os.Getwd()
18+
require.NoError(t, err, "Failed to get current working directory")
19+
20+
// Start from current directory and walk up until we find go.mod
21+
dir := cwd
22+
for {
23+
goModPath := filepath.Join(dir, "go.mod")
24+
if _, err := os.Stat(goModPath); err == nil {
25+
return dir
26+
}
27+
28+
parent := filepath.Dir(dir)
29+
if parent == dir {
30+
// Reached filesystem root
31+
t.Fatalf("Could not find go.mod file starting from %s", cwd)
32+
}
33+
dir = parent
34+
}
35+
}
36+
1437
// getNamespaceName gets the single network namespace name
1538
// Fails if there are 0 or multiple namespaces
1639
func getNamespaceName(t *testing.T) string {
@@ -37,9 +60,12 @@ func getNamespaceName(t *testing.T) string {
3760
}
3861

3962
func TestBoundaryIntegration(t *testing.T) {
63+
// Find project root by looking for go.mod file
64+
projectRoot := findProjectRoot(t)
65+
4066
// Build the boundary binary
4167
buildCmd := exec.Command("go", "build", "-o", "/tmp/boundary-test", "./cmd/...")
42-
buildCmd.Dir = "/home/coder/boundary"
68+
buildCmd.Dir = projectRoot
4369
err := buildCmd.Run()
4470
require.NoError(t, err, "Failed to build boundary binary")
4571

0 commit comments

Comments
 (0)