Skip to content

Commit ddb5c65

Browse files
authored
test: add buffer to both sides of token expiry validation (#1797)
This helps account for skew and timing issues. Fixes: #1783
1 parent b35900a commit ddb5c65

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

integration-tests/byoid/integration_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -443,8 +443,8 @@ func TestConfigurableTokenLifetime(t *testing.T) {
443443
}
444444

445445
now := time.Now()
446-
expiryMax := now.Add(tokenLifetimeSeconds * time.Second)
447-
expiryMin := expiryMax.Add(-safetyBuffer * time.Second)
446+
expiryMax := now.Add((safetyBuffer + tokenLifetimeSeconds) * time.Second)
447+
expiryMin := now.Add((tokenLifetimeSeconds - safetyBuffer) * time.Second)
448448
if token.Expiry.Before(expiryMin) || token.Expiry.After(expiryMax) {
449449
t.Fatalf("Expiry time not set correctly. Got %v, want %v", token.Expiry, expiryMax)
450450
}

0 commit comments

Comments
 (0)