From 5573c629b59c72b5572382ed314cf16ac09bee08 Mon Sep 17 00:00:00 2001 From: Ryan Richard Date: Wed, 13 Sep 2023 12:48:10 -0700 Subject: [PATCH] remove extra timeoutCtx for exec.CommandContext invocations in e2e test These extra timeout contexts were only in the new multiple IDPs e2e test. Remove this possible cause of test cleanup flakes where the test runs slow enough in CI that this timeout context has already expired and then the cleanup function fails with context deadline exceeded errors. --- test/integration/e2e_test.go | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/test/integration/e2e_test.go b/test/integration/e2e_test.go index f684b512..b145d46a 100644 --- a/test/integration/e2e_test.go +++ b/test/integration/e2e_test.go @@ -1390,10 +1390,8 @@ func TestE2EFullIntegration_Browser(t *testing.T) { // Run "kubectl get namespaces" which should trigger an LDAP-style login CLI prompt via the plugin for the LDAP IDP. t.Log("starting LDAP auth via kubectl") - timeoutCtx, cleanupTimeoutCtx := context.WithTimeout(testCtx, 10*time.Second) - t.Cleanup(cleanupTimeoutCtx) start := time.Now() - kubectlCmd := exec.CommandContext(timeoutCtx, "kubectl", "get", "namespace", "--kubeconfig", ldapKubeconfigPath) + kubectlCmd := exec.CommandContext(testCtx, "kubectl", "get", "namespace", "--kubeconfig", ldapKubeconfigPath) kubectlCmd.Env = append(os.Environ(), env.ProxyEnv()...) ptyFile, err := pty.Start(kubectlCmd) require.NoError(t, err) @@ -1420,9 +1418,7 @@ func TestE2EFullIntegration_Browser(t *testing.T) { // Run "kubectl get namespaces" which should trigger a browser login via the plugin for the OIDC IDP. t.Log("starting OIDC auth via kubectl") - timeoutCtx, cleanupTimeoutCtx = context.WithTimeout(testCtx, 10*time.Second) - t.Cleanup(cleanupTimeoutCtx) - kubectlCmd = exec.CommandContext(timeoutCtx, "kubectl", "get", "namespace", "--kubeconfig", oidcKubeconfigPath, "-v", "6") + kubectlCmd = exec.CommandContext(testCtx, "kubectl", "get", "namespace", "--kubeconfig", oidcKubeconfigPath, "-v", "6") kubectlCmd.Env = append(os.Environ(), env.ProxyEnv()...) // Run the kubectl command, wait for the Pinniped CLI to print the authorization URL, and open it in the browser. @@ -1507,9 +1503,7 @@ func TestE2EFullIntegration_Browser(t *testing.T) { // Run "kubectl get namespaces" which should trigger an LDAP-style login CLI prompt via the plugin for the LDAP IDP. t.Log("starting second LDAP auth via kubectl") - timeoutCtx, cleanupTimeoutCtx = context.WithTimeout(testCtx, 10*time.Second) - t.Cleanup(cleanupTimeoutCtx) - kubectlCmd = exec.CommandContext(timeoutCtx, "kubectl", "get", "namespace", "--kubeconfig", ldapKubeconfigPath) + kubectlCmd = exec.CommandContext(testCtx, "kubectl", "get", "namespace", "--kubeconfig", ldapKubeconfigPath) kubectlCmd.Env = append(os.Environ(), env.ProxyEnv()...) ptyFile, err = pty.Start(kubectlCmd) require.NoError(t, err)