From f610a7e8275ba6dfa7202fea97474f360f4afaf6 Mon Sep 17 00:00:00 2001 From: Cody Oss Date: Tue, 3 Jan 2023 12:28:48 -0600 Subject: [PATCH] test: add buffer to both sides of token expiry validation 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) }