From 255f2c00df2156810e571a1a575db25b5051518f Mon Sep 17 00:00:00 2001 From: Markus Rudy Date: Fri, 8 Mar 2024 17:28:30 +0100 Subject: [PATCH] e2e: wait for all required pods before running test --- e2e/openssl/openssl_test.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/e2e/openssl/openssl_test.go b/e2e/openssl/openssl_test.go index e45ff65284..f79190cbfc 100644 --- a/e2e/openssl/openssl_test.go +++ b/e2e/openssl/openssl_test.go @@ -21,7 +21,12 @@ import ( ) // namespace the tests are executed in. -const namespaceEnv = "K8S_NAMESPACE" +const ( + namespaceEnv = "K8S_NAMESPACE" + + opensslFrontend = "openssl-frontend" + opensslBackend = "openssl-backend" +) // TestOpenSSL runs e2e tests on the example OpenSSL deployment. func TestOpenSSL(t *testing.T) { @@ -76,6 +81,8 @@ func TestOpenSSL(t *testing.T) { require := require.New(t) + require.NoError(c.WaitForDeployment(ctx, namespace, opensslFrontend)) + addr, cancelPortForward, err := c.PortForwardPod(ctx, namespace, "port-forwarder-openssl-frontend", "443") require.NoError(err) defer cancelPortForward() @@ -99,9 +106,6 @@ func TestOpenSSL(t *testing.T) { c := kubeclient.NewForTest(t) - const opensslFrontend = "openssl-frontend" - const opensslBackend = "openssl-backend" - require.NoError(c.WaitForDeployment(ctx, namespace, opensslFrontend)) require.NoError(c.WaitForDeployment(ctx, namespace, opensslBackend))