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 write operation in test_it_reads_data_from_an_expired_session.

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 expiration check occurs. This can cause the test to fail intermittently.

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

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