Skip to content

Conversation

@sumaiazaman
Copy link
Contributor

@sumaiazaman sumaiazaman commented Nov 25, 2025

This PR fixes a flaky test by freezing time before the increment operation in testNonExistingKeysCanBeIncremented.

Problem:
Without freezing time, there's a small window where time can advance between when the cache value is incremented (which records a timestamp) and when subsequent time-based checks occur. This can cause the test to fail intermittently.

Solution:
Add Carbon::setTestNow(Carbon::now()); before the increment() operation to ensure consistent timing throughout the test.

This prevents timing race conditions where time can advance between
when the cache value is incremented (which records a timestamp) and
when subsequent time-based checks occur, causing intermittent test failures.
@taylorotwell taylorotwell merged commit 8a41491 into laravel:12.x Nov 25, 2025
76 checks passed
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.

2 participants