1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
package e2e
import (
"fmt"
"os"
"os/exec"
"path/filepath"
"strings"
"testing"
)
func TestDataPlaneConnectivity(t *testing.T) {
t.Skip("not implemented")
}
func TestNetworkIsolation(t *testing.T) {
// 1. Determine project root
cwd, err := os.Getwd()
if err != nil {
t.Fatalf("Failed to get cwd: %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")
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
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) {
t.Skip("not implemented")
}
func TestMTUFragmentation(t *testing.T) {
t.Skip("not implemented")
}
|