1
1
package e2e_tests
2
2
3
3
import (
4
+ "bytes"
4
5
"context"
5
6
"os"
6
7
"os/exec"
@@ -16,15 +17,15 @@ import (
16
17
func findProjectRoot (t * testing.T ) string {
17
18
cwd , err := os .Getwd ()
18
19
require .NoError (t , err , "Failed to get current working directory" )
19
-
20
+
20
21
// Start from current directory and walk up until we find go.mod
21
22
dir := cwd
22
23
for {
23
24
goModPath := filepath .Join (dir , "go.mod" )
24
25
if _ , err := os .Stat (goModPath ); err == nil {
25
26
return dir
26
27
}
27
-
28
+
28
29
parent := filepath .Dir (dir )
29
30
if parent == dir {
30
31
// Reached filesystem root
@@ -62,7 +63,7 @@ func getNamespaceName(t *testing.T) string {
62
63
func TestBoundaryIntegration (t * testing.T ) {
63
64
// Find project root by looking for go.mod file
64
65
projectRoot := findProjectRoot (t )
65
-
66
+
66
67
// Build the boundary binary
67
68
buildCmd := exec .Command ("go" , "build" , "-o" , "/tmp/boundary-test" , "./cmd/..." )
68
69
buildCmd .Dir = projectRoot
@@ -98,11 +99,16 @@ func TestBoundaryIntegration(t *testing.T) {
98
99
t .Run ("HTTPRequestThroughBoundary" , func (t * testing.T ) {
99
100
// Run curl directly in the namespace using ip netns exec
100
101
curlCmd := exec .Command ("sudo" , "ip" , "netns" , "exec" , namespaceName ,
101
- "curl" , "-s" , " http://jsonplaceholder.typicode.com/todos/1" )
102
+ "curl" , "http://jsonplaceholder.typicode.com/todos/1" )
102
103
103
- // Capture output
104
+ // Capture stderr separately
105
+ var stderr bytes.Buffer
106
+ curlCmd .Stderr = & stderr
104
107
output , err := curlCmd .Output ()
105
- require .NoError (t , err , "curl command failed" )
108
+
109
+ if err != nil {
110
+ t .Fatalf ("curl command failed: %v, stderr: %s, output: %s" , err , stderr .String (), string (output ))
111
+ }
106
112
107
113
// Verify response contains expected content
108
114
expectedResponse := `{
0 commit comments