-
Notifications
You must be signed in to change notification settings - Fork 11.7k
[12.x] Introduce WithCachedConfig testing trait
#57663
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| { | ||
| $app->instance('config_loaded_from_cache', true); // I'm not sure this is actually needed | ||
|
|
||
| LoadConfiguration::setAlwaysUseConfig(static fn () => CachedState::$cachedConfig); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any concern here about someone storing an object in cache that can be modified between tests? We could serialize/unserialize it on each test. This would cost some CPU cycles for each test, but could insulate us from that problem. Not sure how often people are storing mutable objects in their configurations 🤔
|
@cosmastech is this one compatible with |
Yes, that's how I was testing it. |
Are you using any specific command? Because in our tests it isn't getting the right connections and throwing this error: |
🤔 and it's working fine without these added? I was just running it via |
With the This is the command I'm using BTW thank you for this great addition. |
|
Glad you are able to see benefits from this. I just created a new repo with a few dumb tests in it. I had no problem running the processes in parallel. Would you mind creating a repo that I can test against? Following the steps outlined here would might make it easier to debug as well #57689 (comment) 🙏 Ooh, I see where the issue is coming from. Can you tell me what other traits you have applied in the test? |
|
I think I found the issue too. Initially I added it to the base |
Building off of #57623
This change has two benefits:
We cache the. This has been moved into its own PR: [12.x] Cache the result ofApplication@configurationIsCached()check, so this will benefit anyone running the app to reduce unnecessary repeated file_exists() for the cached configconfigurationIsCached()#57665On our pipeline, I observed the following:
WithCachedRoutes: 05:41.584WithCachedRoutesandWithCachedConfig: 04:28.769 🤯