(t *testing.T)
| 78 | } |
| 79 | |
| 80 | func TestProcessWithError(t *testing.T) { |
| 81 | queue := parallelwork.NewQueue() |
| 82 | |
| 83 | testError := errors.New("test error") //nolint:err113 |
| 84 | |
| 85 | // Enqueue work items, one of them returns an error |
| 86 | queue.EnqueueBack(context.Background(), func() error { |
| 87 | time.Sleep(100 * time.Millisecond) |
| 88 | return nil |
| 89 | }) |
| 90 | queue.EnqueueBack(context.Background(), func() error { |
| 91 | return testError |
| 92 | }) |
| 93 | queue.EnqueueBack(context.Background(), func() error { |
| 94 | time.Sleep(100 * time.Millisecond) |
| 95 | return nil |
| 96 | }) |
| 97 | |
| 98 | err := queue.Process(context.Background(), 2) // Use two workers |
| 99 | require.Equal(t, testError, err) |
| 100 | } |
| 101 | |
| 102 | func TestWaitForActiveWorkers(t *testing.T) { |
| 103 | queue := parallelwork.NewQueue() |
nothing calls this directly
no test coverage detected