(t *testing.T, size, workerCount int, processFunc ProcessFunc[T])
| 14 | ) |
| 15 | |
| 16 | func newQueue[T any](t *testing.T, size, workerCount int, processFunc ProcessFunc[T]) *Queue[T] { |
| 17 | cfg := Config{Name: "testName", TenantID: "testTenantID", Size: size, WorkerCount: workerCount} |
| 18 | |
| 19 | logger := log.NewNopLogger() |
| 20 | q := New(cfg, logger, processFunc) |
| 21 | |
| 22 | t.Cleanup(func() { |
| 23 | ctx, cancel := context.WithTimeout(context.Background(), 1*time.Second) |
| 24 | defer cancel() |
| 25 | |
| 26 | require.NoError(t, q.Shutdown(ctx)) |
| 27 | |
| 28 | // Metrics are defined on package-level, we need to reset them each time. |
| 29 | pushesTotalMetrics.Reset() |
| 30 | pushesFailuresTotalMetric.Reset() |
| 31 | lengthMetric.Reset() |
| 32 | }) |
| 33 | |
| 34 | return q |
| 35 | } |
| 36 | |
| 37 | func newStartedQueue[T any](t *testing.T, size, workerCount int, processFunc ProcessFunc[T]) *Queue[T] { |
| 38 | q := newQueue(t, size, workerCount, processFunc) |
no test coverage detected