From 1b7174058d3fdc54270d20fbd1fc214c12e3c9c8 Mon Sep 17 00:00:00 2001 From: Martin Hrabovcin Date: Thu, 17 Oct 2024 17:57:24 +0200 Subject: [PATCH] fix: wait for upgrade to complete --- apptests/appscenarios/traefik_test.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/apptests/appscenarios/traefik_test.go b/apptests/appscenarios/traefik_test.go index fa9f7ef82..571d57511 100644 --- a/apptests/appscenarios/traefik_test.go +++ b/apptests/appscenarios/traefik_test.go @@ -225,9 +225,11 @@ func assertTraefikEndpoints(t *traefik, podList *corev1.PodList) { listOptions := &ctrlClient.ListOptions{ LabelSelector: selector, } - err = k8sClient.List(ctx, podList, listOptions) - Expect(err).To(BeNil()) - Expect(podList.Items).To(HaveLen(1)) + + Eventually(func() ([]corev1.Pod, error) { + err := k8sClient.List(ctx, podList, listOptions) + return podList.Items, err + }).WithPolling(5 * time.Second).WithTimeout(time.Minute).Should(HaveLen(1)) By("checking traefik prometheus metrics endpoint") res := restClientV1Pods.Get().Resource("pods").Namespace(podList.Items[0].Namespace).Name(podList.Items[0].Name + ":9100").SubResource("proxy").Suffix("/metrics").Do(ctx)