diff options
| author | James O'Doherty <james@theodohertyfamily.com> | 2026-05-22 11:12:21 -0400 |
|---|---|---|
| committer | James O'Doherty <james@theodohertyfamily.com> | 2026-05-22 11:12:21 -0400 |
| commit | 3b56ccecf46b83fa9b0e4b6c54be6ffda395910c (patch) | |
| tree | 2a4f7b8598cfdfaec2627ec13d4bfb30c14e28fd /tests/e2e/e2e_test.go | |
| parent | cefff85a054d64f124aa1f3e91b9425695aa210b (diff) | |
Implement automatic namespace lifecycle cleanup with last-man-out reference counting
Diffstat (limited to 'tests/e2e/e2e_test.go')
| -rw-r--r-- | tests/e2e/e2e_test.go | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/tests/e2e/e2e_test.go b/tests/e2e/e2e_test.go index fb763b3..7b5858c 100644 --- a/tests/e2e/e2e_test.go +++ b/tests/e2e/e2e_test.go @@ -1,10 +1,7 @@ package e2e import ( - "fmt" - "os" "os/exec" - "path/filepath" "strings" "testing" ) @@ -14,36 +11,23 @@ func TestDataPlaneConnectivity(t *testing.T) { } func TestNetworkIsolation(t *testing.T) { - // 1. Determine project root - cwd, err := os.Getwd() + // 1. Determine binary path + binaryPath, err := GetBinaryPath() if err != nil { - t.Fatalf("Failed to get cwd: %v", err) + t.Skipf("Skipping test: %v", err) } - root := filepath.Join(cwd, "..", "..") - // 2. Build the project to ensure we have a fresh binary - buildCmd := exec.Command("bash", "-c", fmt.Sprintf( - "cd %s && gcc -static -O2 internal/namespace/launcher_src/launcher.c -o internal/namespace/launcher.bin && export CGO_ENABLED=1 && go build -o wg-wrap cmd/wg-wrap/main.go", - root)) - if err := buildCmd.Run(); err != nil { - t.Fatalf("Failed to build project for E2E test: %v", err) - } - - // 3. Run the test-ns command using the binary in the root - binaryPath := filepath.Join(root, "wg-wrap") + // 2. Run the test-ns command using the binary cmd := exec.Command(binaryPath, "test-ns") out, err := cmd.CombinedOutput() if err != nil { t.Fatalf("wg-wrap test-ns failed: %v\nOutput: %s", err, string(out)) } - // 4. Verify the success message + // 3. Verify the success message if !strings.Contains(string(out), "Isolation Verified: OK") { t.Errorf("Expected 'Isolation Verified: OK', got: %q", string(out)) } - - // Cleanup - _ = os.Remove(binaryPath) } func TestDNSLeakage(t *testing.T) { |
