MCPcopy Create free account
hub / github.com/cortexproject/cortex / TestShouldConvertBlockToParquet

Function TestShouldConvertBlockToParquet

pkg/storage/parquet/util_test.go:12–67  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func TestShouldConvertBlockToParquet(t *testing.T) {
13 for _, tc := range []struct {
14 name string
15 mint, maxt int64
16 durations tsdb.DurationList
17 expected bool
18 }{
19 {
20 name: "2h block. Don't convert",
21 mint: 0,
22 maxt: 2 * time.Hour.Milliseconds(),
23 durations: tsdb.DurationList{2 * time.Hour, 12 * time.Hour},
24 expected: false,
25 },
26 {
27 name: "1h block. Don't convert",
28 mint: 0,
29 maxt: 1 * time.Hour.Milliseconds(),
30 durations: tsdb.DurationList{2 * time.Hour, 12 * time.Hour},
31 expected: false,
32 },
33 {
34 name: "3h block. Convert",
35 mint: 0,
36 maxt: 3 * time.Hour.Milliseconds(),
37 durations: tsdb.DurationList{2 * time.Hour, 12 * time.Hour},
38 expected: true,
39 },
40 {
41 name: "12h block. Convert",
42 mint: 0,
43 maxt: 12 * time.Hour.Milliseconds(),
44 durations: tsdb.DurationList{2 * time.Hour, 12 * time.Hour},
45 expected: true,
46 },
47 {
48 name: "12h block with 1h offset. Convert",
49 mint: time.Hour.Milliseconds(),
50 maxt: 13 * time.Hour.Milliseconds(),
51 durations: tsdb.DurationList{2 * time.Hour, 12 * time.Hour},
52 expected: true,
53 },
54 {
55 name: "24h block. Convert",
56 mint: 0,
57 maxt: 24 * time.Hour.Milliseconds(),
58 durations: tsdb.DurationList{2 * time.Hour, 12 * time.Hour},
59 expected: true,
60 },
61 } {
62 t.Run(tc.name, func(t *testing.T) {
63 res := ShouldConvertBlockToParquet(tc.mint, tc.maxt, (&tc.durations).ToMilliseconds())
64 require.Equal(t, tc.expected, res)
65 })
66 }
67}

Callers

nothing calls this directly

Calls 4

ToMillisecondsMethod · 0.80
RunMethod · 0.65
EqualMethod · 0.65

Tested by

no test coverage detected