fix(BRIDGE-17): broken telemetry heartbeat test

This commit is contained in:
Atanas Janeshliev
2024-04-25 11:16:13 +00:00
parent 6ea970bf97
commit 8469e0a661

View File

@ -65,8 +65,10 @@ func TestHeartbeat_default_heartbeat(t *testing.T) {
func TestHeartbeat_already_sent_heartbeat(t *testing.T) { func TestHeartbeat_already_sent_heartbeat(t *testing.T) {
withHeartbeat(t, 1143, 1025, "/tmp", "defaultKeychain", func(hb *telemetry.Heartbeat, mock *mocks.MockHeartbeatManager) { withHeartbeat(t, 1143, 1025, "/tmp", "defaultKeychain", func(hb *telemetry.Heartbeat, mock *mocks.MockHeartbeatManager) {
mock.EXPECT().IsTelemetryAvailable(context.Background()).Return(true) mock.EXPECT().IsTelemetryAvailable(context.Background()).Return(true)
mock.EXPECT().GetLastHeartbeatSent().Return(time.Now().Truncate(24 * time.Hour)) mock.EXPECT().GetLastHeartbeatSent().DoAndReturn(func() time.Time {
curTime := time.Now()
return time.Date(curTime.Year(), curTime.Month(), curTime.Day(), 0, 0, 0, 0, curTime.Location())
})
hb.TrySending(context.Background()) hb.TrySending(context.Background())
}) })
} }