TestQueryRangeSingleTrace checks count for a single trace Single trace creates a block with startTime == endTime which covers a few edge cases under the hood.
(t *testing.T)
| 546 | // Single trace creates a block with startTime == endTime |
| 547 | // which covers a few edge cases under the hood. |
| 548 | func TestQueryRangeSingleTrace(t *testing.T) { |
| 549 | util.RunIntegrationTests(t, util.TestHarnessConfig{ |
| 550 | DeploymentMode: util.DeploymentModeSingleBinary, // for unknown reasons this fails on microservices mode. TODO: figure that crap out |
| 551 | }, func(h *util.TempoHarness) { |
| 552 | h.WaitTracesWritable(t) |
| 553 | // Emit a single trace |
| 554 | require.NoError(t, h.WriteJaegerBatch(util.MakeThriftBatch(), "")) |
| 555 | |
| 556 | h.WaitTracesQueryable(t, 1) |
| 557 | |
| 558 | // Query the trace by count. As we have only one trace, we should get one dot with value 1 |
| 559 | query := "{} | count_over_time()" |
| 560 | callQueryRange(t, h, queryRangeRequest{Query: query, Exemplars: 100}, func(queryRangeRes *tempopb.QueryRangeResponse, err error) { |
| 561 | require.NoError(t, err) |
| 562 | require.NotNil(t, queryRangeRes) |
| 563 | require.Equal(t, len(queryRangeRes.GetSeries()), 1) |
| 564 | |
| 565 | series := queryRangeRes.GetSeries()[0] |
| 566 | assert.Equal(t, len(series.GetExemplars()), 1) |
| 567 | |
| 568 | var sum float64 |
| 569 | for _, sample := range series.GetSamples() { |
| 570 | sum += sample.Value |
| 571 | } |
| 572 | require.InDelta(t, sum, 1, 0.000001) |
| 573 | }) |
| 574 | }) |
| 575 | } |
| 576 | |
| 577 | func TestQueryRangeMaxSeries(t *testing.T) { |
| 578 | util.RunIntegrationTests(t, util.TestHarnessConfig{ |
nothing calls this directly
no test coverage detected