From eadb9c7419a3372e0fc9ca16b3fb3439fceeda98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Corentin=20N=C3=A9au?= Date: Mon, 20 Oct 2025 13:30:56 +0200 Subject: [PATCH] Reduce flakiness of signal handling tests End-to-end tests for signal handling depend on availability of deployments, which may be affected by other running test suites, as is the case of the Fleet agent with pod disruption budgets and priority classes. Therefore, signal handling tests now retry killing a deployment if that deployment or its targeted container is not available. --- e2e/single-cluster/signals_test.go | 36 ++++++++++++++++++------------ 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/e2e/single-cluster/signals_test.go b/e2e/single-cluster/signals_test.go index f3e2fa3829..84239c32aa 100644 --- a/e2e/single-cluster/signals_test.go +++ b/e2e/single-cluster/signals_test.go @@ -28,8 +28,10 @@ var _ = Describe("Shuts down gracefully", func() { }) JustBeforeEach(func() { - out, err := k.Run("exec", "deploy/fleet-agent", "--", "kill", "1") - Expect(err).ToNot(HaveOccurred(), out) + Eventually(func(g Gomega) { + out, err := k.Run("exec", "deploy/fleet-agent", "--", "kill", "1") + g.Expect(err).ToNot(HaveOccurred(), out) + }).Should(Succeed()) }) It("exits gracefully", func() { @@ -59,11 +61,13 @@ var _ = Describe("Shuts down gracefully", func() { }) JustBeforeEach(func() { - pod, err := k.Get("pod", "-l", labels, "-o", "jsonpath={.items[0].metadata.name}") - Expect(err).ToNot(HaveOccurred(), pod) + Eventually(func(g Gomega) { + pod, err := k.Get("pod", "-l", labels, "-o", "jsonpath={.items[0].metadata.name}") + g.Expect(err).ToNot(HaveOccurred(), pod) - out, err := k.Run("exec", pod, "--", "kill", "1") - Expect(err).ToNot(HaveOccurred(), out) + out, err := k.Run("exec", pod, "--", "kill", "1") + g.Expect(err).ToNot(HaveOccurred(), out) + }).Should(Succeed()) }) It("exits gracefully", func() { @@ -93,11 +97,13 @@ var _ = Describe("Shuts down gracefully", func() { }) JustBeforeEach(func() { - pod, err := k.Get("pod", "-l", labels, "-o", "jsonpath={.items[0].metadata.name}") - Expect(err).ToNot(HaveOccurred(), pod) + Eventually(func(g Gomega) { + pod, err := k.Get("pod", "-l", labels, "-o", "jsonpath={.items[0].metadata.name}") + g.Expect(err).ToNot(HaveOccurred(), pod) - out, err := k.Run("exec", pod, "--", "kill", "1") - Expect(err).ToNot(HaveOccurred(), out) + out, err := k.Run("exec", pod, "--", "kill", "1") + g.Expect(err).ToNot(HaveOccurred(), out) + }) }) It("exits gracefully", func() { @@ -127,11 +133,13 @@ var _ = Describe("Shuts down gracefully", func() { }) JustBeforeEach(func() { - pod, err := k.Get("pod", "-l", labels, "-o", "jsonpath={.items[0].metadata.name}") - Expect(err).ToNot(HaveOccurred(), pod) + Eventually(func(g Gomega) { + pod, err := k.Get("pod", "-l", labels, "-o", "jsonpath={.items[0].metadata.name}") + g.Expect(err).ToNot(HaveOccurred(), pod) - out, err := k.Run("exec", pod, "--", "kill", "1") - Expect(err).ToNot(HaveOccurred(), out) + out, err := k.Run("exec", pod, "--", "kill", "1") + g.Expect(err).ToNot(HaveOccurred(), out) + }) }) It("exits gracefully", func() {