internal/listtoken: remove overzealous validation

Validating that the update time of the last item is after the
create time of the token cannot account for items whose
update time are earlier than the original query because of
the added database transaction timeout buffer. Remove the
check.
pull/4202/head
Johan Brandhorst-Satzkorn 2 years ago
parent 6181f34497
commit af61b688c6

@ -387,8 +387,6 @@ func (tk *Token) Validate(
return errors.New(ctx, errors.InvalidParameter, op, "list token's refresh component missing last item ID")
case st.LastItemUpdateTime.After(time.Now()):
return errors.New(ctx, errors.InvalidParameter, op, "list token's refresh component's last item was updated in the future")
case st.LastItemUpdateTime.Before(tk.CreateTime):
return errors.New(ctx, errors.InvalidParameter, op, "list token's refresh component's last item was updated before the list token's creation time")
}
case *PaginationToken:
switch {

@ -873,25 +873,6 @@ func Test_ValidateRefreshToken(t *testing.T) {
wantErrString: "list token's refresh component missing last item ID",
wantErrCode: errors.InvalidParameter,
},
{
name: "last item update before create time",
token: &listtoken.Token{
CreateTime: fiveDaysAgo,
ResourceType: resource.Target,
GrantsHash: []byte("some hash"),
Subtype: &listtoken.RefreshToken{
PhaseUpperBound: fiveDaysAgo,
PreviousDeletedIdsTime: fiveDaysAgo,
PhaseLowerBound: fiveDaysAgo,
LastItemId: "some id",
LastItemUpdateTime: fiveDaysAgo.AddDate(-1, 0, 0),
},
},
grantsHash: []byte("some hash"),
resourceType: resource.Target,
wantErrString: "list token's refresh component's last item was updated before the list token's creation time",
wantErrCode: errors.InvalidParameter,
},
{
name: "last item update in future",
token: &listtoken.Token{

Loading…
Cancel
Save