MCPcopy
hub / github.com/grafana/dskit / TestInstanceDesc_GetRegisteredAt

Function TestInstanceDesc_GetRegisteredAt

ring/model_test.go:66–94  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

64}
65
66func TestInstanceDesc_GetRegisteredAt(t *testing.T) {
67 tests := map[string]struct {
68 desc *InstanceDesc
69 expected time.Time
70 }{
71 "should return zero value on nil desc": {
72 desc: nil,
73 expected: time.Time{},
74 },
75 "should return zero value registered timestamp = 0": {
76 desc: &InstanceDesc{
77 RegisteredTimestamp: 0,
78 },
79 expected: time.Time{},
80 },
81 "should return timestamp parsed from desc": {
82 desc: &InstanceDesc{
83 RegisteredTimestamp: time.Unix(10000000, 0).Unix(),
84 },
85 expected: time.Unix(10000000, 0),
86 },
87 }
88
89 for testName, testData := range tests {
90 t.Run(testName, func(t *testing.T) {
91 assert.True(t, testData.desc.GetRegisteredAt().Equal(testData.expected))
92 })
93 }
94}
95
96func TestInstanceDesc_GetLastHeartbeatAt(t *testing.T) {
97 tests := map[string]struct {

Callers

nothing calls this directly

Calls 3

RunMethod · 0.80
EqualMethod · 0.45
GetRegisteredAtMethod · 0.45

Tested by

no test coverage detected