From ff20ec153fac3ab2701bf5e847a8038b0cb2b24c Mon Sep 17 00:00:00 2001 From: slyt3 Date: Thu, 4 Dec 2025 15:50:06 +0200 Subject: [PATCH] Fix logic bug in WaitForPodsReady that incorrectly reports pods as ready --- test/e2e/thv-operator/virtualmcp/helpers.go | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/test/e2e/thv-operator/virtualmcp/helpers.go b/test/e2e/thv-operator/virtualmcp/helpers.go index 48db910ae..be28fd8af 100644 --- a/test/e2e/thv-operator/virtualmcp/helpers.go +++ b/test/e2e/thv-operator/virtualmcp/helpers.go @@ -181,11 +181,26 @@ func WaitForPodsReady(ctx context.Context, c client.Client, namespace string, la return fmt.Errorf("pod %s is in phase %s", pod.Name, pod.Status.Phase) } + containerReady := false + podReady := false + for _, condition := range pod.Status.Conditions { - if condition.Type == corev1.ContainersReady && condition.Status != corev1.ConditionTrue { - return fmt.Errorf("pod %s containers not ready", pod.Name) + if condition.Type == corev1.ContainersReady { + containerReady = condition.Status == corev1.ConditionTrue + } + + if condition.Type == corev1.PodReady { + podReady = condition.Status == corev1.ConditionTrue } } + + if !containerReady { + return fmt.Errorf("pod %s containers not ready", pod.Name) + } + + if !podReady { + return fmt.Errorf("pod %s not ready", pod.Name) + } } return nil }, timeout, 5*time.Second).Should(gomega.Succeed())