MCPcopy Create free account
hub / github.com/chainreactors/spray / TestAddAddition_FullBufferUnblocksOnCancel

Function TestAddAddition_FullBufferUnblocksOnCancel

core/pool/pool_test.go:334–350  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

332}
333
334func TestAddAddition_FullBufferUnblocksOnCancel(t *testing.T) {
335 ctx, cancel := context.WithCancel(context.Background())
336 pool := newTestBasePool(ctx, cancel)
337
338 // fill buffer
339 for i := 0; i < cap(pool.additionCh); i++ {
340 pool.additionCh <- &Unit{path: "/fill"}
341 }
342
343 mustFinish(t, 2*time.Second, "addAddition on full buffer not unblocked by cancel", func() {
344 go func() {
345 time.Sleep(50 * time.Millisecond)
346 cancel()
347 }()
348 pool.addAddition(&Unit{path: "/blocked", source: parsers.WordSource})
349 })
350}
351
352func TestAddAddition_ConcurrentShutdown(t *testing.T) {
353 ctx, cancel := context.WithCancel(context.Background())

Callers

nothing calls this directly

Calls 3

newTestBasePoolFunction · 0.85
mustFinishFunction · 0.85
addAdditionMethod · 0.80

Tested by

no test coverage detected