diff --git a/gleak/have_leaked_matcher.go b/gleak/have_leaked_matcher.go index dd6f7ead6..61bf761a4 100644 --- a/gleak/have_leaked_matcher.go +++ b/gleak/have_leaked_matcher.go @@ -8,6 +8,7 @@ import ( "strconv" "strings" + "github.com/onsi/gomega" "github.com/onsi/gomega/format" "github.com/onsi/gomega/gleak/goroutine" "github.com/onsi/gomega/types" @@ -44,6 +45,7 @@ var standardFilters = []types.GomegaMatcher{ // Ginkgo testing framework IgnoringTopFunction("github.com/onsi/ginkgo/v2/internal.(*Suite).runNode"), IgnoringTopFunction("github.com/onsi/ginkgo/v2/internal.(*Suite).runNode..."), + gomega.And(IgnoringTopFunction("runtime.goexit1"), IgnoringCreator("github.com/onsi/ginkgo/v2/internal.(*Suite).runNode")), IgnoringTopFunction("github.com/onsi/ginkgo/v2/internal/interrupt_handler.(*InterruptHandler).registerForInterrupts..."), IgnoringTopFunction("github.com/onsi/ginkgo/internal/specrunner.(*SpecRunner).registerForInterrupts"), diff --git a/gleak/have_leaked_matcher_test.go b/gleak/have_leaked_matcher_test.go index 7d5d0ce65..3f3acb43b 100644 --- a/gleak/have_leaked_matcher_test.go +++ b/gleak/have_leaked_matcher_test.go @@ -77,7 +77,8 @@ created by main.foo`, }) It("considers testing and runtime goroutines not to be leaks", func() { - Expect(Goroutines()).NotTo(HaveLeaked(), "should not find any leaks by default") + Eventually(Goroutines).WithTimeout(2*time.Second).WithPolling(250*time.Millisecond). + ShouldNot(HaveLeaked(), "should not find any leaks by default") }) When("using signals", func() {