(t *testing.T)
| 64 | } |
| 65 | |
| 66 | func 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 | |
| 96 | func TestInstanceDesc_GetLastHeartbeatAt(t *testing.T) { |
| 97 | tests := map[string]struct { |
nothing calls this directly
no test coverage detected