From 377b5db7d72411d77c0e12b4b99381507bfb82a8 Mon Sep 17 00:00:00 2001 From: Brian Upton Date: Tue, 3 Dec 2024 12:17:58 -0800 Subject: [PATCH] Handle ginkgo assertions in goroutines 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 --- jobsupervisor/monit_job_supervisor_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/jobsupervisor/monit_job_supervisor_test.go b/jobsupervisor/monit_job_supervisor_test.go index 7269585db..6d6a16719 100644 --- a/jobsupervisor/monit_job_supervisor_test.go +++ b/jobsupervisor/monit_job_supervisor_test.go @@ -734,6 +734,8 @@ var _ = Describe("monitJobSupervisor", func() { } go func() { + defer GinkgoRecover() + err := monit.MonitorJobFailures(failureHandler) Expect(err).NotTo(HaveOccurred()) }() @@ -767,6 +769,8 @@ var _ = Describe("monitJobSupervisor", func() { } go func() { + defer GinkgoRecover() + err := monit.MonitorJobFailures(failureHandler) Expect(err).NotTo(HaveOccurred()) }()