Skip to content

Commit

Permalink
Handle ginkgo assertions in goroutines
Browse files Browse the repository at this point in the history
Per ginkgo docs, if an assertion fails in a goroutine, it will cause a
panic unless you call `defer GinkgoRecover()`

Signed-off-by: Chris Selzo <[email protected]>
  • Loading branch information
ystros authored and selzoc committed Dec 3, 2024
1 parent f60f838 commit 377b5db
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions jobsupervisor/monit_job_supervisor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,8 @@ var _ = Describe("monitJobSupervisor", func() {
}

go func() {
defer GinkgoRecover()

err := monit.MonitorJobFailures(failureHandler)
Expect(err).NotTo(HaveOccurred())
}()
Expand Down Expand Up @@ -767,6 +769,8 @@ var _ = Describe("monitJobSupervisor", func() {
}

go func() {
defer GinkgoRecover()

err := monit.MonitorJobFailures(failureHandler)
Expect(err).NotTo(HaveOccurred())
}()
Expand Down

0 comments on commit 377b5db

Please sign in to comment.