You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have noticed tests failing when utilizing time travel alongside the Redis cache driver. The tests pass when using the array cache driver. A simplified test showing the problem is being provided.
it('travel can clear cache', function (): void {
Cache::set('test', true, 5);
travel(5)->seconds(); // passes using array only
expect(Cache::get('test'))->toBeNull();
});
it('sleep can clear cache', function (): void {
Cache::set('test', true, 5);
sleep(5); // passes using redis and array
expect(Cache::get('test'))->toBeNull();
});
I assume that while Laravel is managing the array cache, the redis cache is being handed off to native Redis handlers causing the time manipulation to have no effect on the cache state.
This would impact not only direct cache access but any functionality that relies on the underlying cache driver such as throttling.
Is this the intended functionality? Should this be documented in mocking -> time travel to help developers understand the limitations on time manipulation?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
We have noticed tests failing when utilizing time travel alongside the Redis cache driver. The tests pass when using the array cache driver. A simplified test showing the problem is being provided.
I assume that while Laravel is managing the array cache, the redis cache is being handed off to native Redis handlers causing the time manipulation to have no effect on the cache state.
This would impact not only direct cache access but any functionality that relies on the underlying cache driver such as throttling.
Is this the intended functionality? Should this be documented in mocking -> time travel to help developers understand the limitations on time manipulation?
Beta Was this translation helpful? Give feedback.
All reactions