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

Function TestTimeFromMillis

pkg/util/time_test.go:19–34  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

17)
18
19func TestTimeFromMillis(t *testing.T) {
20 var testExpr = []struct {
21 input int64
22 expected time.Time
23 }{
24 {input: 1000, expected: time.Unix(1, 0)},
25 {input: 1500, expected: time.Unix(1, 500*nanosecondsInMillisecond)},
26 }
27
28 for i, c := range testExpr {
29 t.Run(fmt.Sprint(i), func(t *testing.T) {
30 res := TimeFromMillis(c.input)
31 require.Equal(t, c.expected, res)
32 })
33 }
34}
35
36func TestDurationWithJitter(t *testing.T) {
37 const numRuns = 1000

Callers

nothing calls this directly

Calls 3

TimeFromMillisFunction · 0.85
RunMethod · 0.65
EqualMethod · 0.65

Tested by

no test coverage detected