(t *testing.T)
| 350 | } |
| 351 | |
| 352 | func TestAddAddition_ConcurrentShutdown(t *testing.T) { |
| 353 | ctx, cancel := context.WithCancel(context.Background()) |
| 354 | pool := newTestBasePool(ctx, cancel) |
| 355 | |
| 356 | var ext sync.WaitGroup |
| 357 | for i := 0; i < 200; i++ { |
| 358 | ext.Add(1) |
| 359 | go func() { |
| 360 | defer ext.Done() |
| 361 | pool.addAddition(&Unit{path: "/c", source: parsers.WordSource}) |
| 362 | }() |
| 363 | } |
| 364 | |
| 365 | time.Sleep(2 * time.Millisecond) |
| 366 | cancel() |
| 367 | |
| 368 | // drain so senders can unblock |
| 369 | go func() { |
| 370 | for range pool.additionCh { |
| 371 | pool.wg.Done() |
| 372 | } |
| 373 | }() |
| 374 | |
| 375 | mustFinish(t, 5*time.Second, "concurrent addAddition+cancel hung", func() { |
| 376 | ext.Wait() |
| 377 | }) |
| 378 | close(pool.additionCh) |
| 379 | } |
| 380 | |
| 381 | // --------------------------------------------------------------------------- |
| 382 | // sendProcess |
nothing calls this directly
no test coverage detected