From 842ef388686127ad8b43dfad821d4cc6ab14e1ef Mon Sep 17 00:00:00 2001 From: Margo Crawford Date: Thu, 20 Jan 2022 13:43:29 -0800 Subject: [PATCH] Ensure warning is on stderr and not stdout. --- test/integration/e2e_test.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/integration/e2e_test.go b/test/integration/e2e_test.go index 76c9bf00f..4f3345414 100644 --- a/test/integration/e2e_test.go +++ b/test/integration/e2e_test.go @@ -443,7 +443,8 @@ func TestE2EFullIntegration(t *testing.T) { // nolint:gocyclo start := time.Now() kubectlCmd := exec.CommandContext(ctx, "kubectl", "get", "namespace", "--kubeconfig", kubeconfigPath) kubectlCmd.Env = append(os.Environ(), env.ProxyEnv()...) - + stdoutPipe, err := kubectlCmd.StdoutPipe() + require.NoError(t, err) ptyFile, err := pty.Start(kubectlCmd) require.NoError(t, err) @@ -485,9 +486,10 @@ func TestE2EFullIntegration(t *testing.T) { // nolint:gocyclo t.Logf("waiting for kubectl to output namespace list") // Read all output from the subprocess until EOF. // Ignore any errors returned because there is always an error on linux. - kubectlOutputBytes, _ := ioutil.ReadAll(ptyFile) - requireKubectlGetNamespaceOutput(t, env, string(kubectlOutputBytes)) - require.Contains(t, string(kubectlOutputBytes), "Access token from identity provider has lifetime of less than 3 hours. Expect frequent prompts to log in.") + kubectlStdOutOutputBytes, _ := ioutil.ReadAll(stdoutPipe) + kubectlStdErrOutputBytes, _ := ioutil.ReadAll(ptyFile) + requireKubectlGetNamespaceOutput(t, env, string(kubectlStdOutOutputBytes)) + require.Contains(t, string(kubectlStdErrOutputBytes), "Access token from identity provider has lifetime of less than 3 hours. Expect frequent prompts to log in.") t.Logf("first kubectl command took %s", time.Since(start).String())