From ed83260222a0ef7986a1aa9d3e84b173eb2bd30e Mon Sep 17 00:00:00 2001 From: Jordi Gil Date: Tue, 23 Jan 2024 22:56:01 -0500 Subject: [PATCH] Tweak platform services test to avoid checking for the workflow's health status since some finish quicker than the time it takes for the logic to evaluate the health endpoint and causes a test failure Signed-off-by: Jordi Gil --- test/e2e/platform_test.go | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/test/e2e/platform_test.go b/test/e2e/platform_test.go index 39149719b..e9b8edf13 100644 --- a/test/e2e/platform_test.go +++ b/test/e2e/platform_test.go @@ -99,29 +99,18 @@ var _ = Describe("Validate the persistence", Ordered, func() { manifests, err = utils.Run(cmd) Expect(err).NotTo(HaveOccurred()) - By("Wait for SonatatFlow CR to complete deployment") - EventuallyWithOffset(1, func() error { - cmd = exec.Command("kubectl", "wait", "pod", "-n", targetNamespace, "-l", "sonataflow.org/workflow-app", "--for", "condition=Ready", "--timeout=30s") - _, err = utils.Run(cmd) - return err - }, 5*time.Minute, 5).Should(Succeed()) - - By("Evaluate status of the workflow pod health endpoint") - - cmd = exec.Command("kubectl", "get", "pod", "-n", targetNamespace, `-ojsonpath={.items[?(@.metadata.labels.sonataflow\.org/workflow-app)].metadata.name}`) - output, err = utils.Run(cmd) - Expect(err).NotTo(HaveOccurred()) - for _, pn := range strings.Split(string(output), "\n") { - verifyHealthStatusInPod(pn, targetNamespace) - } - By("Evaluate status of SonataFlow CR") + By("Retrieve SonataFlow CR name") cmd = exec.Command("kubectl", "get", "sonataflow", "-n", targetNamespace, `-ojsonpath={.items[*].metadata.name}`) output, err = utils.Run(cmd) Expect(err).NotTo(HaveOccurred()) - sfNames := strings.TrimRight(string(output), "\n") - for _, sf := range strings.Split(string(sfNames), "\n") { + sfNames := strings.TrimRight(string(output), " ") + + By("Evaluate status of SonataFlow CR") + for _, sf := range strings.Split(string(sfNames), " ") { Expect(sf).NotTo(BeEmpty(), "sonataflow name is empty") - EventuallyWithOffset(1, func() bool { return verifyWorkflowIsInRunningStateInNamespace(sf, targetNamespace) }, 15*time.Minute, 15).Should(BeTrue()) + EventuallyWithOffset(1, func() bool { + return verifyWorkflowIsInRunningStateInNamespace(sf, targetNamespace) + }, 5*time.Minute, 5).Should(BeTrue()) } }, Entry("with both Job Service and Data Index and ephemeral persistence and the workflow in a dev profile", test.GetSonataFlowE2EPlatformServicesDirectory(), dev, ephemeral),