MCPcopy
hub / github.com/nats-io/nats.go / TestRecvChanAsyncLeakGoRoutines

Function TestRecvChanAsyncLeakGoRoutines

test/netchan_test.go:253–279  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

251}
252
253func TestRecvChanAsyncLeakGoRoutines(t *testing.T) {
254 s := RunDefaultServer()
255 defer s.Shutdown()
256
257 ec := NewEConn(t)
258 defer ec.Close()
259
260 // Call this to make sure that we have everything setup connection wise
261 ec.Flush()
262
263 base := getStableNumGoroutine(t)
264
265 ch := make(chan int)
266
267 if _, err := ec.BindRecvChan("foo", ch); err != nil {
268 t.Fatalf("Failed to bind to a send channel: %v\n", err)
269 }
270
271 // Close the receive Channel
272 close(ch)
273
274 // The publish will trigger the close and shutdown of the Go routines
275 ec.Publish("foo", 22)
276 ec.Flush()
277
278 checkNoGoroutineLeak(t, base, "closing channel")
279}
280
281func TestRecvChanLeakGoRoutines(t *testing.T) {
282 s := RunDefaultServer()

Callers

nothing calls this directly

Calls 9

NewEConnFunction · 0.85
getStableNumGoroutineFunction · 0.85
checkNoGoroutineLeakFunction · 0.85
BindRecvChanMethod · 0.80
FatalfMethod · 0.80
RunDefaultServerFunction · 0.70
PublishMethod · 0.65
CloseMethod · 0.45
FlushMethod · 0.45

Tested by

no test coverage detected