github.com/onsi/gomega@v1.32.0/gleak/ginkgo_parallel_client.go (about) 1 package gleak 2 3 import "os" 4 5 // IgnoreGinkgoParallelClient must be called in a BeforeSuite whenever a test 6 // suite is run in parallel with other test suites using "ginkgo -p". Calling 7 // IgnoreGinkgoParallelClient checks for a Ginkgo-related background go routine 8 // and then updates gleak's internal ignore list to specifically ignore this 9 // background go routine by its ("random") ID. 10 func IgnoreGinkgoParallelClient() { 11 ignoreCreator := "net/rpc.NewClientWithCodec" 12 if os.Getenv("GINKGO_PARALLEL_PROTOCOL") == "HTTP" { 13 ignoreCreator = "net/http.(*Transport).dialConn" 14 } 15 ignores := []Goroutine{} 16 for _, g := range Goroutines() { 17 if g.CreatorFunction == ignoreCreator { 18 ignores = append(ignores, g) 19 } 20 } 21 if len(ignores) == 0 { 22 return 23 } 24 standardFilters = append(standardFilters, IgnoringGoroutines(ignores)) 25 }