Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion discovery/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,14 +372,18 @@ func Test_sqlStore_setPresentationRefreshError(t *testing.T) {
t.Run("store", func(t *testing.T) {
c := setupStore(t, storageEngine.GetSQLDatabase())

// LastOccurrence is stored in whole seconds, so compare against a timestamp
// taken before the call instead of "now minus a second": the latter fails
// when the call and the assertion straddle a second boundary.
before := int(time.Now().Unix())
require.NoError(t, c.updatePresentationRefreshTime(testServiceID, aliceSubject, nil, to.Ptr(time.Now().Add(time.Second))))
require.NoError(t, c.setPresentationRefreshError(testServiceID, aliceSubject, assert.AnError))

// Check if the error is stored
refreshError := getPresentationRefreshError(t, c.db, testServiceID, aliceSubject)

assert.Equal(t, refreshError.Error, assert.AnError.Error())
assert.True(t, refreshError.LastOccurrence > int(time.Now().Add(-1*time.Second).Unix()))
assert.GreaterOrEqual(t, refreshError.LastOccurrence, before)
})
t.Run("deletePresentationRecord", func(t *testing.T) {
c := setupStore(t, storageEngine.GetSQLDatabase())
Expand Down
Loading