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

This commit is contained in:
Todd Knight authored and GitHub committed 2020-07-28 08:59:09 -04:00
1 parent 25514fb553
commit a0bed2b5d7
1 file changed
+2 -2
+2 -2
View File
@@ -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
}