-
Notifications
You must be signed in to change notification settings - Fork 916
Assume test assets are precompiled #18869
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
Why? First of all, live compiling of assets is true by default in the test environment in rails so we need to get back to the defaults. Sadly, this causes a 2 minute delay running any UI spec that calls image_path/asset_path directly or indirectly. Flamegraphs from rbspy show that the 2 minutes delay running a local ui-classic test that calls image_path/asset_path is in sprocket-rails in the call to asset_precompiled? which calls precompiled_assets(true) if you're not caching classes, such as test. It then needs to look through all asset paths for precompiled assets to build a manifest and ends up calling stat_tree / stat_directory in all these paths, such as the node_modules. We can assume the assets are precompiled as we compile them on demand and can avoid this 2 minute stat'ing of files and directories. It's unclear if this has any negative consequences. https://github.com/rails/sprockets-rails/blob/v3.2.1/lib/sprockets/railtie.rb#L39
|
Checked commit jrafanie@f408d98 with ruby 2.3.3, rubocop 0.69.0, haml-lint 0.20.0, and yamllint 1.10.0 |
|
cc @martinpovolny @himdel Thoughts? |
|
Note, I have had this running against my rails 5.1 tests for ui-classic and manageiq-api and they're green. |
not any, but first Yes. therefor we disabled it.
Why do we need get back to the defaults? ping @himdel |
Very true. Thankfully, it's only the first time that we hits this. It's awful.
The alternative to the default of If there is a problem with the I feel like sprockets-rails should be changed to not stat all the asset paths on first call to image_path/asset_path in the test environment but I just don't understand the use cases of assets with rails in test to offer a pull request there. |
|
@himdel @martinpovolny I replied above but neglected to mention you... |
| env.cache = ActiveSupport::Cache.lookup_store(:memory_store) | ||
| end | ||
|
|
||
| config.assets.compile = ENV['TEST_SUITE'] == 'spec:javascript' |
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.
Note, if we keep this logic, it will have to also add the spec and api test suites since they would also need to precompile their assets instead of live compile them.
It feels like live compilation is less intrusive.
|
LGTM, (And, as mentioned in ManageIQ/manageiq-api#606 (comment), most of the remaining code using the asset pipeline will go away when we move patternfly to webpack in ManageIQ/manageiq-ui-classic#5679.) |
|
(Also confirming ui-classic specs still pass with the change 👍.) |
Extracted from #18076
Why? First of all, live compiling of assets is true by default in the
test environment in rails so we need to get back to the defaults.
Sadly, this causes a 2 minute delay running any UI spec that calls
image_path/asset_path directly or indirectly.
Flamegraphs from rbspy show that the 2 minutes delay running a local
ui-classic test that calls image_path/asset_path is in sprocket-rails
in the call to asset_precompiled? which calls precompiled_assets(true)
if you're not caching classes, such as test. It then needs to look
through all asset paths for precompiled assets to build a manifest and
ends up calling stat_tree / stat_directory in all these paths, such
as the node_modules. We can assume the assets are precompiled as we
compile them on demand and can avoid this 2 minute stat'ing of files and
directories. It's unclear if this has any negative consequences.
https://github.com/rails/sprockets-rails/blob/v3.2.1/lib/sprockets/railtie.rb#L39