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 Action View tests #44529

Merged
merged 1 commit into from Feb 25, 2022

Conversation

clayton-shopify
Copy link
Contributor

@clayton-shopify clayton-shopify commented Feb 23, 2022

Summary

Various Action View tests randomly fail with errors like the following:

ActionView::Template::Error: undefined method `__rails_actionview_test_fixtures_test__customer_erb___1906185013242363930_25680' for #<ActionView::Base:0x000000000115a8>

Here's an example of a failing build: https://buildkite.com/rails/rails/builds/84207#3bc8eb7f-c86d-4f6f-8932-e2e8c26cf893

A number of test classes use ActionView::LookupContext::DetailsKey.clear in their setup method to clear out a cache before executing tests, but the failing test classes do not have this. Adding it eliminates the failures. After making these changes, I ran the test suite in a loop (while bundle exec bin/test; do :; done) for 12 hours and did not observe any failures.

Note: I don't understand the details of the caching mechanism that's at play here, so I'm not certain that this is the best fix. I noticed some past PRs for flaky tests that could be related:

@rails-bot rails-bot bot added the actionview label Feb 23, 2022
@rafaelfranca rafaelfranca merged commit b64cbc0 into rails:main Feb 25, 2022
@rafaelfranca rafaelfranca deleted the actionview-fix-flaky-tests branch February 25, 2022 19:47
rafaelfranca added a commit that referenced this pull request Feb 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants