From ade9a53045f310e8e4d9349a2e856b9ec8348155 Mon Sep 17 00:00:00 2001 From: Philip Laine Date: Tue, 10 Mar 2026 21:31:54 +0100 Subject: [PATCH] Fix flaky e2e tests (#120) This change fixes flaky e2e tests with two changes. The first is that the manager container is checked for ready condition rather than running. The second is that the webhook server has been registered as part of the health check to verify it is running before reporting ready state. Signed-off-by: Philip Laine --- cmd/main.go | 3 ++- test/e2e/e2e_test.go | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd/main.go b/cmd/main.go index 5f8f91e..5f98103 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -224,6 +224,7 @@ func main() { os.Exit(1) } } + if len(netbirdAPIKey) > 0 { if err = (&controller.NBRoutingPeerReconciler{ Client: mgr.GetClient(), @@ -314,7 +315,7 @@ func main() { setupLog.Error(err, "unable to set up health check") os.Exit(1) } - if err := mgr.AddReadyzCheck("readyz", healthz.Ping); err != nil { + if err := mgr.AddReadyzCheck("readyz", mgr.GetWebhookServer().StartedChecker()); err != nil { setupLog.Error(err, "unable to set up ready check") os.Exit(1) } diff --git a/test/e2e/e2e_test.go b/test/e2e/e2e_test.go index 9c40486..e1b4783 100644 --- a/test/e2e/e2e_test.go +++ b/test/e2e/e2e_test.go @@ -155,12 +155,13 @@ var _ = Describe("Manager", Ordered, func() { // Validate the pod's status cmd = exec.Command("kubectl", "get", - "pods", controllerPodName, "-o", "jsonpath={.status.phase}", + "pods", controllerPodName, + "-o", "jsonpath={.status.conditions[?(@.type=='Ready')].status}", "-n", namespace, ) output, err := utils.Run(cmd) g.Expect(err).NotTo(HaveOccurred()) - g.Expect(output).To(Equal("Running"), "Incorrect kubernetes-operator pod status") + g.Expect(output).To(Equal("True"), "Incorrect kubernetes-operator pod status") } Eventually(verifyControllerUp).Should(Succeed()) })