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

Function TestCompletionTracker

modules/frontend/shardtracker/tracker_test.go:9–192  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

7)
8
9func TestCompletionTracker(t *testing.T) {
10 const addShards = -1
11
12 tcs := []struct {
13 name string
14 add []int // -1 means send shards
15 shards []Shard
16 exp []uint32 // expected completedThroughSeconds after each operation
17 }{
18 // shards only
19 {
20 name: "shards only",
21 add: []int{addShards},
22 shards: []Shard{
23 {
24 TotalJobs: 1,
25 CompletedThroughSeconds: 100,
26 },
27 },
28 exp: []uint32{0},
29 },
30 // indexes only
31 {
32 name: "indexes only",
33 add: []int{1, 0, 1, 3, 2, 0, 1, 1},
34 shards: []Shard{
35 {
36 TotalJobs: 1,
37 CompletedThroughSeconds: 100,
38 },
39 },
40 exp: []uint32{0, 0, 0, 0, 0, 0, 0, 0},
41 },
42 // first shard complete, shards first
43 {
44 name: "first shard complete, shards first",
45 add: []int{addShards, 0},
46 shards: []Shard{
47 {
48 TotalJobs: 1,
49 CompletedThroughSeconds: 100,
50 },
51 },
52 exp: []uint32{0, 1}, // 1 = TimestampAlways when all shards complete
53 },
54 // first shard complete, index first
55 {
56 name: "first shard complete, index first",
57 add: []int{0, addShards},
58 shards: []Shard{
59 {
60 TotalJobs: 1,
61 CompletedThroughSeconds: 100,
62 },
63 },
64 exp: []uint32{0, 1}, // 1 = TimestampAlways when all shards complete
65 },
66 // shards received at various times

Callers

nothing calls this directly

Calls 5

AddShardsMethod · 0.95
AddShardIdxMethod · 0.95
LenMethod · 0.65
RunMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected