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

Function TestSendProcess_ConcurrentShutdown

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

Source from the content-addressed store, hash-verified

428}
429
430func TestSendProcess_ConcurrentShutdown(t *testing.T) {
431 ctx, cancel := context.WithCancel(context.Background())
432 pool := newTestBasePool(ctx, cancel)
433
434 var ext sync.WaitGroup
435 for i := 0; i < 200; i++ {
436 ext.Add(1)
437 go func() {
438 defer ext.Done()
439 pool.sendProcess(newTestBaseline())
440 }()
441 }
442
443 time.Sleep(2 * time.Millisecond)
444 cancel()
445
446 go func() {
447 for range pool.processCh {
448 }
449 }()
450
451 mustFinish(t, 5*time.Second, "concurrent sendProcess+cancel hung", func() {
452 ext.Wait()
453 })
454 close(pool.processCh)
455}
456
457// ---------------------------------------------------------------------------
458// putToOutput

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected