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

Function TestRecvChanLeakGoRoutines

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

Source from the content-addressed store, hash-verified

279}
280
281func TestRecvChanLeakGoRoutines(t *testing.T) {
282 s := RunDefaultServer()
283 defer s.Shutdown()
284
285 ec := NewEConn(t)
286 defer ec.Close()
287
288 // Call this to make sure that we have everything setup connection wise
289 ec.Flush()
290
291 base := getStableNumGoroutine(t)
292
293 ch := make(chan int)
294
295 sub, err := ec.BindRecvChan("foo", ch)
296 if err != nil {
297 t.Fatalf("Failed to bind to a send channel: %v\n", err)
298 }
299 sub.Unsubscribe()
300
301 checkNoGoroutineLeak(t, base, "Unsubscribe()")
302}
303
304func TestRecvChanMultipleMessages(t *testing.T) {
305 // Make sure we can receive more than one message.

Callers

nothing calls this directly

Calls 9

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

Tested by

no test coverage detected