From 1f75b01dfaaa14ad73b3bffee2d716f879c8749f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pereira?= Date: Thu, 15 Aug 2024 10:58:04 -0500 Subject: [PATCH] Change the test to polling instead of just a single sleep MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Avoid flakyness due to time it takes to bind a service Signed-off-by: João Pereira --- .../v7/isolated/service_command_test.go | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/integration/v7/isolated/service_command_test.go b/integration/v7/isolated/service_command_test.go index c2f1c340c8..013b0db1db 100644 --- a/integration/v7/isolated/service_command_test.go +++ b/integration/v7/isolated/service_command_test.go @@ -171,17 +171,17 @@ var _ = Describe("service command", func() { }) It("displays the bound apps", func() { - //Delay to reduce flakiness - time.Sleep(10 * time.Second) - session := helpers.CF(serviceCommand, serviceInstanceName, "-v") - Eventually(session).Should(Exit(0)) - - Expect(session).To(SatisfyAll( - Say(`Showing bound apps:\n`), - Say(`name\s+binding name\s+status\s+message\n`), - Say(`%s\s+%s\s+create succeeded\s*\n`, appName1, bindingName1), - Say(`%s\s+%s\s+create succeeded\s*\n`, appName2, bindingName2), - )) + Eventually(func(g Gomega) { + session := helpers.CF(serviceCommand, serviceInstanceName, "-v").Wait() + g.Expect(session).Should(Exit(0)) + output := session.Buffer().Contents() + g.Expect(output).Should(SatisfyAll( + Say(`Showing bound apps:\n`), + Say(`name\s+binding name\s+status\s+message\n`), + ContainSubstring(`%s\s+%s\s+create succeeded\s*\n`, appName1, bindingName1), + ContainSubstring(`%s\s+%s\s+create succeeded\s*\n`, appName2, bindingName2), + )) + }).Should(Succeed()) }) })