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

Function TestStepRangeToIntervals

pkg/traceql/engine_metrics_test.go:47–87  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

45}
46
47func TestStepRangeToIntervals(t *testing.T) {
48 tc := []struct {
49 start, end, step uint64
50 instant bool
51 expected int
52 }{
53 {
54 start: 10,
55 end: 11,
56 step: 1,
57 instant: false,
58 expected: 1,
59 },
60 {
61 start: 0,
62 end: 3,
63 step: 1,
64 instant: false,
65 expected: 3, // 1, 2, 3
66 },
67 {
68 start: 0,
69 end: 10,
70 step: 3,
71 instant: false,
72 expected: 4, // 3, 6, 9, 12
73 },
74 {
75 start: 0,
76 end: 10,
77 step: 3,
78 instant: true,
79 expected: 1, // for instant queries, always only one interval
80 },
81 }
82
83 for _, c := range tc {
84 mapper := NewIntervalMapper(c.start, c.end, c.step, c.instant)
85 require.Equal(t, c.expected, mapper.IntervalCount())
86 }
87}
88
89func TestTimestampOf(t *testing.T) {
90 tc := []struct {

Callers

nothing calls this directly

Calls 3

IntervalCountMethod · 0.95
NewIntervalMapperFunction · 0.85
EqualMethod · 0.45

Tested by

no test coverage detected