Skip to content

Commit

Permalink
Make cf readiness event tests less flakey
Browse files Browse the repository at this point in the history
* Move the check of the cf eve for readiness health checks until AFTER a different check that has a long timeout.
* We should wait to see that the app is marked ready/not-ready BEFORE we test cf events
  • Loading branch information
ameowlia authored and ctlong committed Jan 25, 2024
1 parent d36bc9c commit 0bf2062
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 3 additions & 5 deletions apps/readiness_healthcheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,16 @@ var _ = AppsDescribe("Readiness Healthcheck", func() {
return helpers.CurlApp(Config, appName, "/ready")
}, Config.DefaultTimeoutDuration()).Should(ContainSubstring("200 - ready"))

Eventually(cf.Cf("events", appName)).Should(Say("app.process.ready"))

Expect(logs.Recent(appName).Wait()).To(Say("Container passed the readiness health check"))

Eventually(cf.Cf("events", appName)).Should(Say("app.process.ready"))

By("triggering the app to make the /ready endpoint fail")
helpers.CurlApp(Config, appName, "/ready/false")

By("verifying the app is marked as not ready")

Eventually(cf.Cf("events", appName)).Should(Say("app.process.not-ready"))

Eventually(func() BufferProvider { return logs.Recent(appName).Wait() }, readinessHealthCheckTimeout).Should(Say("Container failed the readiness health check"))
Eventually(cf.Cf("events", appName)).Should(Say("app.process.not-ready"))

By("verifying the app is removed from the routing table")
Eventually(func() string {
Expand Down
4 changes: 2 additions & 2 deletions windows/readiness_healthcheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ var _ = WindowsDescribe("Readiness Healthcheck", func() {
return helpers.CurlApp(Config, appName, "/ready")
}, Config.DefaultTimeoutDuration()).Should(ContainSubstring("200 - ready"))

Eventually(cf.Cf("events", appName)).Should(Say("app.process.ready"))

Expect(logs.Recent(appName).Wait()).To(Say("Container passed the readiness health check"))

Eventually(cf.Cf("events", appName)).Should(Say("app.process.ready"))

By("triggering the app to make the /ready endpoint fail")
helpers.CurlApp(Config, appName, "/ready/false")

Expand Down

0 comments on commit 0bf2062

Please sign in to comment.