Skip to content

Freeze the clock in TestCacheLen and TestCacheCapacity - #434

Open
AshSgDe29071999 wants to merge 1 commit into
allegro:mainfrom
AshSgDe29071999:fix/test-cache-len-clock
Open

Freeze the clock in TestCacheLen and TestCacheCapacity#434
AshSgDe29071999 wants to merge 1 commit into
allegro:mainfrom
AshSgDe29071999:fix/test-cache-len-clock

Conversation

@AshSgDe29071999

Copy link
Copy Markdown

LifeWindow is stored in whole Unix seconds, so a 1s window expires at the next wall-clock second. Crossing that boundary mid-loop made TestCacheLen flake.

Use a frozen mockedClock so inserts cannot expire during the loop.

Fixes #433

Test

go test . -run 'TestCacheLen|TestCacheCapacity' -count=1

LifeWindow is stored in whole Unix seconds, so a 1s window expires at
the next wall-clock second. Crossing that boundary mid-loop made
TestCacheLen flake.

See allegro#433
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TestCacheLen is flaky: a 1s LifeWindow expires entries at the next Unix second, not 1s after insertion

1 participant