MCPcopy
hub / github.com/grafana/tempo / newQueue

Function newQueue

modules/distributor/queue/queue_test.go:16–35  ·  view source on GitHub ↗
(t *testing.T, size, workerCount int, processFunc ProcessFunc[T])

Source from the content-addressed store, hash-verified

14)
15
16func 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
37func newStartedQueue[T any](t *testing.T, size, workerCount int, processFunc ProcessFunc[T]) *Queue[T] {
38 q := newQueue(t, size, workerCount, processFunc)

Calls 3

NewFunction · 0.70
ShutdownMethod · 0.65
ResetMethod · 0.65

Tested by

no test coverage detected