Skip to content

Commit

Permalink
fix flaky goroutine leak detection test (#552)
Browse files Browse the repository at this point in the history
  • Loading branch information
thediveo authored May 5, 2022
1 parent e77ea75 commit 4b5d86c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions gleak/have_leaked_matcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"),

Expand Down
3 changes: 2 additions & 1 deletion gleak/have_leaked_matcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 4b5d86c

Please sign in to comment.