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

Function TestPutToOutput_AfterCancel

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

Source from the content-addressed store, hash-verified

500}
501
502func TestPutToOutput_AfterCancel(t *testing.T) {
503 ctx, cancel := context.WithCancel(context.Background())
504 pool := newTestBasePool(ctx, cancel)
505 cancel()
506
507 mustFinish(t, 2*time.Second, "putToOutput blocked after cancel", func() {
508 pool.putToOutput(newTestBaseline())
509 })
510 // select may have picked OutputCh (buffer available) or ctx.Done();
511 // drain if sent so Outwg stays balanced.
512 select {
513 case <-pool.OutputCh:
514 pool.Outwg.Done()
515 default:
516 }
517 pool.Outwg.Wait()
518}
519
520func TestPutToOutput_OutwgBalance(t *testing.T) {
521 ctx, cancel := context.WithCancel(context.Background())

Callers

nothing calls this directly

Calls 5

newTestBasePoolFunction · 0.85
mustFinishFunction · 0.85
newTestBaselineFunction · 0.85
putToOutputMethod · 0.80
DoneMethod · 0.45

Tested by

no test coverage detected