From ddb5c65423cbe6c3489912e8e5f0b6ed6afb5f6e Mon Sep 17 00:00:00 2001 From: Cody Oss <6331106+codyoss@users.noreply.github.com> Date: Tue, 3 Jan 2023 18:44:13 +0000 Subject: [PATCH] test: add buffer to both sides of token expiry validation (#1797) This helps account for skew and timing issues. Fixes: #1783 --- integration-tests/byoid/integration_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/integration-tests/byoid/integration_test.go b/integration-tests/byoid/integration_test.go index da3074c4233..612cf8eae4c 100644 --- a/integration-tests/byoid/integration_test.go +++ b/integration-tests/byoid/integration_test.go @@ -443,8 +443,8 @@ func TestConfigurableTokenLifetime(t *testing.T) { } now := time.Now() - expiryMax := now.Add(tokenLifetimeSeconds * time.Second) - expiryMin := expiryMax.Add(-safetyBuffer * time.Second) + expiryMax := now.Add((safetyBuffer + tokenLifetimeSeconds) * time.Second) + expiryMin := now.Add((tokenLifetimeSeconds - safetyBuffer) * time.Second) if token.Expiry.Before(expiryMin) || token.Expiry.After(expiryMax) { t.Fatalf("Expiry time not set correctly. Got %v, want %v", token.Expiry, expiryMax) }