Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the test to polling instead of just a single sleep [main] #3112

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions integration/v7/isolated/service_command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
))
Comment on lines +181 to +183
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ContainSubstring(`%s\s+%s\s+create succeeded\s*\n`, appName1, bindingName1),
ContainSubstring(`%s\s+%s\s+create succeeded\s*\n`, appName2, bindingName2),
))
))
sessionContents := string(session.Out.Contents())
Expect(strings.Contains(sessionContents, fmt.Sprintf(`%s %s create succeeded`, appName1, bindingName1))).To(BeTrue())
Expect(strings.Contains(sessionContents, fmt.Sprintf(`%s %s create succeeded`, appName2, bindingName2))).To(BeTrue())

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found the test can fail if app2 is listed first. If we get the session contents and search it for substrings the order doesn't matter.

}).Should(Succeed())
})
})

Expand Down
Loading