summaryrefslogtreecommitdiff
path: root/tests/e2e/e2e_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'tests/e2e/e2e_test.go')
-rw-r--r--tests/e2e/e2e_test.go37
1 files changed, 8 insertions, 29 deletions
diff --git a/tests/e2e/e2e_test.go b/tests/e2e/e2e_test.go
index 939d231..907bb22 100644
--- a/tests/e2e/e2e_test.go
+++ b/tests/e2e/e2e_test.go
@@ -13,10 +13,7 @@ import (
func TestDataPlaneConnectivity(t *testing.T) {
// 1. Determine binary path
- binaryPath, err := GetBinaryPath()
- if err != nil {
- t.Skipf("Skipping test: %v", err)
- }
+ binaryPath := EnsureBinary(t)
// 2. Setup isolated config & runtime folders for testing
tmpDir := t.TempDir()
@@ -78,10 +75,7 @@ AllowedIPs = 10.0.0.0/24
}
}()
- err = cmd.Run()
- // We expect the command (ping) to fail because our mock peer does not complete
- // the handshake or reply to pings, but we log the error for diagnostic purposes.
- if err != nil {
+ if err := cmd.Run(); err != nil {
t.Logf("wg-wrap command returned error (expected since mock peer doesn't reply): %v", err)
}
@@ -100,10 +94,7 @@ AllowedIPs = 10.0.0.0/24
}
func TestNetworkIsolation(t *testing.T) {
- binaryPath, err := GetBinaryPath()
- if err != nil {
- t.Skipf("Skipping test: %v", err)
- }
+ binaryPath := EnsureBinary(t)
cmd := exec.Command(binaryPath, "test-ns")
out, err := cmd.CombinedOutput()
@@ -117,10 +108,7 @@ func TestNetworkIsolation(t *testing.T) {
}
func TestDNSIsolation(t *testing.T) {
- binaryPath, err := GetBinaryPath()
- if err != nil {
- t.Skipf("Skipping test: %v", err)
- }
+ binaryPath := EnsureBinary(t)
// 1. Start Mock DNS Server
dnsServer, port := StartMockDNSServer(t)
@@ -190,10 +178,7 @@ AllowedIPs = 10.0.0.0/24
}
func TestDNSPrecedence(t *testing.T) {
- binaryPath, err := GetBinaryPath()
- if err != nil {
- t.Skipf("Skipping test: %v", err)
- }
+ binaryPath := EnsureBinary(t)
tmpDir := t.TempDir()
profileName := "test-dns-precedence"
@@ -276,10 +261,7 @@ AllowedIPs = 10.0.0.0/24
}
func TestMTUFragmentation(t *testing.T) {
- binaryPath, err := GetBinaryPath()
- if err != nil {
- t.Skipf("Skipping test: %v", err)
- }
+ binaryPath := EnsureBinary(t)
cmd := exec.Command(binaryPath, "--profile", "default", "--", "true")
if err := cmd.Run(); err != nil {
@@ -288,14 +270,11 @@ func TestMTUFragmentation(t *testing.T) {
}
func TestExitCodePropagation(t *testing.T) {
- binaryPath, err := GetBinaryPath()
- if err != nil {
- t.Skipf("Skipping test: %v", err)
- }
+ binaryPath := EnsureBinary(t)
// Run a command that exits with code 42
cmd := exec.Command(binaryPath, "--profile", "default", "--", "sh", "-c", "exit 42")
- err = cmd.Run()
+ err := cmd.Run()
if err == nil {
t.Fatalf("expected command to fail with exit status 42, but it succeeded")
}