From a0bed2b5d74bbbc8a766a600a85f385ec561a556 Mon Sep 17 00:00:00 2001 From: Todd Knight Date: Tue, 28 Jul 2020 05:59:09 -0700 Subject: [PATCH] Truncate instead of round timestamps so our tests that require a time to pass can succeed. (#224) --- internal/authtoken/repository.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/authtoken/repository.go b/internal/authtoken/repository.go index 320311ad4d..bf1e4e214b 100644 --- a/internal/authtoken/repository.go +++ b/internal/authtoken/repository.go @@ -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 }