From e9b546188f9a29f370400cd1fe2713511e9f26e1 Mon Sep 17 00:00:00 2001 From: Russell Centanni Date: Tue, 30 Jul 2024 19:28:28 -0400 Subject: [PATCH] test: fix terminal test expectation Signed-off-by: Russell Centanni --- e2e/tests/terminal/terminal.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/e2e/tests/terminal/terminal.go b/e2e/tests/terminal/terminal.go index 0ca590f8a..749131f26 100644 --- a/e2e/tests/terminal/terminal.go +++ b/e2e/tests/terminal/terminal.go @@ -16,6 +16,7 @@ import ( "github.com/loft-sh/devspace/pkg/devspace/devpod" "github.com/loft-sh/devspace/pkg/util/factory" "github.com/onsi/ginkgo/v2" + "github.com/onsi/gomega" kerrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/wait" @@ -138,9 +139,18 @@ sleep 1000000 }) framework.ExpectNoError(err) - // make sure the pod exists - err = kubeClient.RawClient().CoreV1().Pods(ns).Delete(context.TODO(), podName, metav1.DeleteOptions{}) - framework.ExpectNoError(err) + gomega.Eventually(func(g gomega.Gomega) { + // make sure the pod exists + _, err := kubeClient.RawClient().CoreV1().Pods(ns).Get(context.TODO(), podName, metav1.GetOptions{}) + g.Expect(err).NotTo(gomega.HaveOccurred()) + + // delete it + err = kubeClient.RawClient().CoreV1().Pods(ns).Delete(context.TODO(), podName, metav1.DeleteOptions{}) + g.Expect(err).NotTo(gomega.HaveOccurred()) + }). + WithPolling(1 * time.Second). + WithTimeout(30 * time.Second). + Should(gomega.Succeed()) // wait until pod is terminated err = wait.PollUntilContextTimeout(context.TODO(), time.Second, time.Minute*3, true, func(ctx context.Context) (done bool, err error) {