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

Function TestMinQueryTime

pkg/testexporter/correctness/runner_test.go:10–32  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func TestMinQueryTime(t *testing.T) {
11 tests := []struct {
12 durationQuerySince time.Duration
13 timeQueryStart TimeValue
14 expected time.Time
15 }{
16 {
17 expected: time.Now(),
18 },
19 {
20 timeQueryStart: NewTimeValue(time.Unix(1234567890, 0)),
21 expected: time.Unix(1234567890, 0),
22 },
23 {
24 durationQuerySince: 10 * time.Hour,
25 expected: time.Now().Add(-10 * time.Hour),
26 },
27 }
28
29 for _, tt := range tests {
30 assert.WithinDuration(t, tt.expected, calculateMinQueryTime(tt.durationQuerySince, tt.timeQueryStart), 50*time.Millisecond)
31 }
32}

Callers

nothing calls this directly

Calls 3

NewTimeValueFunction · 0.85
calculateMinQueryTimeFunction · 0.85
AddMethod · 0.45

Tested by

no test coverage detected