Truncate instead of round timestamps so our tests that require a time to pass can succeed. (#224)

pull/205/head
Todd Knight 6 years ago committed by GitHub
parent 25514fb553
commit a0bed2b5d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -86,9 +86,9 @@ func (r *Repository) CreateAuthToken(ctx context.Context, withIamUserId, withAut
at.Token = token
// TODO: Allow the caller to specify something different than the default duration.
// We round the expiration time to the nearest second to make testing in different platforms with
// We truncate the expiration time to the nearest second to make testing in different platforms with
// different time resolutions easier.
expiration, err := ptypes.TimestampProto(time.Now().Round(time.Second).Add(maxTokenDuration))
expiration, err := ptypes.TimestampProto(time.Now().Add(maxTokenDuration).Truncate(time.Second))
if err != nil {
return nil, err
}

Loading…
Cancel
Save