(t *testing.T)
| 27 | } |
| 28 | |
| 29 | func TestAsyncQueue_QueueFullError(t *testing.T) { |
| 30 | const queueLength = 10 |
| 31 | |
| 32 | q := newAsyncQueue(queueLength, 1) |
| 33 | defer q.stop() |
| 34 | |
| 35 | doneCh := make(chan struct{}) |
| 36 | defer func() { |
| 37 | close(doneCh) |
| 38 | }() |
| 39 | |
| 40 | // Keep worker busy. |
| 41 | _ = q.submit(func() { |
| 42 | <-doneCh |
| 43 | }) |
| 44 | time.Sleep(100 * time.Millisecond) |
| 45 | |
| 46 | // Fill the queue. |
| 47 | for i := 0; i < queueLength; i++ { |
| 48 | require.NoError(t, q.submit(func() {})) |
| 49 | } |
| 50 | |
| 51 | require.ErrorIs(t, q.submit(func() {}), errAsyncQueueFull) |
| 52 | } |
nothing calls this directly
no test coverage detected