From 0f3806f77164af99466bfc8c0d7d5f85f9ec078f Mon Sep 17 00:00:00 2001 From: James O'Doherty Date: Fri, 29 May 2026 21:16:13 -0400 Subject: perf: optimize test suite execution and reduce polling - Added `test-lifecycle` CLI command to verify active session state. - Replaced manual filesystem polling and `time.Sleep` in E2E tests with `waitForLifecycle` synchronization. - Optimized `TestConfigHotSwap` by reducing artificial sleep durations. - Fixed linting issue (ST1023) in `internal/cli/cli.go`. These changes reduce total test execution time to under 15 seconds and improve the determinism of lifecycle verification. --- tests/e2e/config_hotswap_test.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'tests/e2e/config_hotswap_test.go') diff --git a/tests/e2e/config_hotswap_test.go b/tests/e2e/config_hotswap_test.go index 6dfcec5..5c483ac 100644 --- a/tests/e2e/config_hotswap_test.go +++ b/tests/e2e/config_hotswap_test.go @@ -42,7 +42,7 @@ Endpoint = 1.1.1.1:51820 } // Start a process to establish the session - cmdA := exec.Command(binaryPath, "--profile", profile, "--", "sleep", "5") + cmdA := exec.Command(binaryPath, "--profile", profile, "--", "sleep", "0.1") cmdA.Env = append(os.Environ(), fmt.Sprintf("XDG_RUNTIME_DIR=%s", tmpRuntimeDir), fmt.Sprintf("XDG_CONFIG_HOME=%s", tmpConfigDir), @@ -52,8 +52,7 @@ Endpoint = 1.1.1.1:51820 } defer func() { _ = cmdA.Process.Kill() }() - pidsDir := filepath.Join(tmpRuntimeDir, "profiles", profile, "pids") - waitForPids(t, pidsDir, 1) + waitForLifecycle(t, binaryPath, tmpRuntimeDir, profile, true) // 2. "Hot-Swap" the configuration file while the tunnel is active. // We change the endpoint to something obviously different. -- cgit v1.2.3