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

Function TestQueueFutureBatches

cmd/tempo-vulture/main_test.go:267–289  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

265}
266
267func TestQueueFutureBatches(t *testing.T) {
268 mockJaegerClient := MockReporter{err: nil}
269 // Define the configuration
270 config := vultureConfiguration{
271 tempoOrgID: "orgID",
272 tempoWriteBackoffDuration: time.Second * 0,
273 }
274
275 seed := time.Date(2008, 1, 1, 12, 0, 0, 0, time.UTC)
276 traceInfo := util.NewTraceInfoWithMaxLongWrites(seed, 1, "test")
277 logger = zap.NewNop()
278
279 queueFutureBatches(&mockJaegerClient, traceInfo, config, logger)
280 time.Sleep(time.Second)
281 require.Greater(t, len(mockJaegerClient.GetEmittedBatches()), 0)
282
283 // Assert an error
284 mockJaegerClient = MockReporter{err: errors.New("an error")}
285
286 queueFutureBatches(&mockJaegerClient, traceInfo, config, logger)
287 time.Sleep(time.Second)
288 require.Equal(t, len(mockJaegerClient.batchesEmitted), 0)
289}
290
291type traceOps func(*tempopb.Trace)
292

Callers

nothing calls this directly

Calls 5

GetEmittedBatchesMethod · 0.95
queueFutureBatchesFunction · 0.85
SleepMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected