Skip to content

Conversation

@sumaiazaman
Copy link
Contributor

This PR fixes a flaky test by freezing time before the write operation in test_it_cleans_up_old_sessions.

Problem:
Without freezing time, there's a small window where time can advance between when the session is written (which records a timestamp) and when the garbage collection check occurs. This can cause the test to fail intermittently.

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

Related:
This follows the same pattern as #57864.

This prevents timing race conditions where time can advance between
when the session is written (which records a timestamp) and when
the garbage collection check occurs, causing intermittent test failures.
@taylorotwell taylorotwell merged commit 6ec8614 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