Skip to content
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

Fix flaky tests, add a template per case on asset debugging tests #43188

Merged
merged 1 commit into from Sep 10, 2021

Conversation

ceritium
Copy link
Contributor

@ceritium ceritium commented Sep 8, 2021

It avoids the problem when the file checker is not able to detect changes
on the files during testing.

Summary

railties/test/application/asset_debugging_test.rb are failing from time to time on CI. After some investigations, I discovered that it is caused due how FileUpdateChecker works. FileUpdateChecker requires 1 second to detect file changes in a file.

This PR avoids the problem of creating a new template per case.

Other Information

It is a PR for debugging the issue #43174

Alternative approaches:

@ceritium ceritium marked this pull request as ready for review September 8, 2021 20:18
@ceritium ceritium changed the title Add a template per case on asset debugging tests Fix flaky tests, add a template per case on asset debugging tests Sep 8, 2021
@p8 p8 added the ready PRs ready to merge label Sep 8, 2021
class ::PostsController < ActionController::Base ; end
cases.each do |(view_method, tag_match)|
app_file "app/views/posts/#{view_method}.html.erb", "<%= #{view_method} '#{contents}', skip_pipeline: true %>"
::PostsController.define_method(:index) { render view_method }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would not this cause a warning since we are defining the same method more than once?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, I didn't notice it on dev, but it appears in the CI. You can see it with ruby -w bin/test test/application/asset_debugging_test.rb

The query implementation approach is easier for avoid that warning, I am going to push another commit without warnings.

@ceritium ceritium force-pushed the asset-debugging-template-per-case branch from 73fcd46 to 5dc8f97 Compare September 9, 2021 13:03
@ghiculescu
Copy link
Member

The red tests seem unrelated. Could you squash commits?

It avoids the problem when the file checker is not able to detect changes
on the files during testing.
@ceritium ceritium force-pushed the asset-debugging-template-per-case branch from 5dc8f97 to 0063fb3 Compare September 9, 2021 20:36
@rafaelfranca rafaelfranca merged commit a692e63 into rails:main Sep 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
railties ready PRs ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants