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

Function TestHandlerDone_ProcessesAllBeforeExit

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

Source from the content-addressed store, hash-verified

636}
637
638func TestHandlerDone_ProcessesAllBeforeExit(t *testing.T) {
639 ctx, cancel := context.WithCancel(context.Background())
640 defer cancel()
641 pool := newTestBasePool(ctx, cancel)
642
643 var count int
644 go func() {
645 defer close(pool.handlerDone)
646 for range pool.processCh {
647 count++
648 }
649 }()
650
651 const N = 20
652 for i := 0; i < N; i++ {
653 pool.processCh <- newTestBaseline()
654 }
655 close(pool.processCh)
656 <-pool.handlerDone
657
658 if count != N {
659 t.Fatalf("handler processed %d items, want %d", count, N)
660 }
661}
662
663// ---------------------------------------------------------------------------
664// Full shutdown sequence (integration-level)

Callers

nothing calls this directly

Calls 2

newTestBasePoolFunction · 0.85
newTestBaselineFunction · 0.85

Tested by

no test coverage detected