summaryrefslogtreecommitdiff
path: root/tests/e2e/e2e_test.go
diff options
context:
space:
mode:
authorJames O'Doherty <james@theodohertyfamily.com>2026-06-07 22:57:34 -0400
committerJames O'Doherty <james@theodohertyfamily.com>2026-06-07 22:57:34 -0400
commitf8afb7d5889f5c8b6ea256fd078fa8426d21c7be (patch)
treebb0683f4abdd22886ddb0b748114abff5dfef4d1 /tests/e2e/e2e_test.go
parent7010768877c227c9410a06908e4cb3e54db403bd (diff)
feat(cli): introduce explicit run/exec subcommands to prevent typo-execution
Prevent the ambiguity where a mistyped subcommand was interpreted as the target wrapped process. - Introduce `run` and `exec` (alias) subcommands for launching wrapped processes. - Promote internal test commands (`test-ns`, `test-args`, `test-lifecycle`) to explicit subcommands. - Update CLI routing to return an error for unknown subcommands instead of falling back to the default execution path. - Update `README.md` usage examples and all test suites to use the new subcommand structure.
Diffstat (limited to 'tests/e2e/e2e_test.go')
-rw-r--r--tests/e2e/e2e_test.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/e2e/e2e_test.go b/tests/e2e/e2e_test.go
index 907bb22..98711e4 100644
--- a/tests/e2e/e2e_test.go
+++ b/tests/e2e/e2e_test.go
@@ -57,7 +57,7 @@ AllowedIPs = 10.0.0.0/24
}
// 3. Launch wg-wrap with a command that triggers traffic
- cmd := exec.Command(binaryPath, "--profile", profile, "--", "ping", "-c", "1", "-W", "1", "10.0.0.1")
+ cmd := exec.Command(binaryPath, "run", "--profile", profile, "--", "ping", "-c", "1", "-W", "1", "10.0.0.1")
cmd.Env = append(os.Environ(),
fmt.Sprintf("XDG_CONFIG_HOME=%s", tmpDir),
fmt.Sprintf("XDG_RUNTIME_DIR=%s", tmpDir),
@@ -138,7 +138,7 @@ AllowedIPs = 10.0.0.0/24
// 3. Test /etc/resolv.conf modification
expectedDNS := "1.1.1.1"
- cmd := exec.Command(binaryPath, "--profile", profile, "--dns-server", expectedDNS, "--", "cat", "/etc/resolv.conf")
+ cmd := exec.Command(binaryPath, "run", "--profile", profile, "--dns-server", expectedDNS, "--", "cat", "/etc/resolv.conf")
cmd.Env = append(os.Environ(),
fmt.Sprintf("XDG_CONFIG_HOME=%s", tmpDir),
fmt.Sprintf("XDG_RUNTIME_DIR=%s", tmpDir),
@@ -154,7 +154,7 @@ AllowedIPs = 10.0.0.0/24
}
// 4. Test Data Path: Send a ping to trigger Handshake on the mock server
- cmdQuery := exec.Command(binaryPath, "--profile", profile, "--", "ping", "-c", "1", "-W", "1", dnsServerIP)
+ cmdQuery := exec.Command(binaryPath, "run", "--profile", profile, "--", "ping", "-c", "1", "-W", "1", dnsServerIP)
cmdQuery.Env = cmd.Env
packetReceived := make(chan bool, 1)
@@ -236,7 +236,7 @@ AllowedIPs = 10.0.0.0/24
_ = os.WriteFile(profilePath, []byte(confContent), 0644)
// Prepare command args
- args := []string{"--profile", profileName}
+ args := []string{"run", "--profile", profileName}
if tt.cliDNS != "" {
args = append(args, "--dns-server", tt.cliDNS)
}
@@ -263,7 +263,7 @@ AllowedIPs = 10.0.0.0/24
func TestMTUFragmentation(t *testing.T) {
binaryPath := EnsureBinary(t)
- cmd := exec.Command(binaryPath, "--profile", "default", "--", "true")
+ cmd := exec.Command(binaryPath, "run", "--profile", "default", "--", "true")
if err := cmd.Run(); err != nil {
t.Errorf("expected command to pass, got: %v", err)
}
@@ -273,7 +273,7 @@ func TestExitCodePropagation(t *testing.T) {
binaryPath := EnsureBinary(t)
// Run a command that exits with code 42
- cmd := exec.Command(binaryPath, "--profile", "default", "--", "sh", "-c", "exit 42")
+ cmd := exec.Command(binaryPath, "run", "--profile", "default", "--", "sh", "-c", "exit 42")
err := cmd.Run()
if err == nil {
t.Fatalf("expected command to fail with exit status 42, but it succeeded")