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 <philip.laine@gmail.com>
This commit is contained in:
Philip Laine
2026-03-10 21:31:54 +01:00
committed by GitHub
parent 60ce12c74e
commit ade9a53045
2 changed files with 5 additions and 3 deletions
+2 -1
View File
@@ -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)
}
+3 -2
View File
@@ -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())
})