-
-
Notifications
You must be signed in to change notification settings - Fork 501
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 ActiveJob tests for Rails 7.2 and 8.0 #2487
Fix ActiveJob tests for Rails 7.2 and 8.0 #2487
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2487 +/- ##
=======================================
Coverage 98.18% 98.18%
=======================================
Files 128 128
Lines 4845 4845
=======================================
Hits 4757 4757
Misses 88 88
|
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.
Thanks! Could you please rebase this on top of latest master before we merge it?
325b3c1
to
7e69e17
Compare
@solnic Done! |
@olivier-thatch on CI we run all the specs, and the spec fails locally only if you run it separately (at least for me). This means that there's some state that changes during whole spec suite run that causes this spec to pass, but it's different when we run it in isolation. |
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.
Thanks, this indeed fixes the problem :)
Description
This PR fixes the test suite so that the ActiveJob related tests pass with Rails 7.2 and 8.0.
While working on the ActiveJob integration, I noticed that one of the tests was failing with Rails 7.2 and 8.0, specifically this one:
sentry-ruby/sentry-rails/spec/sentry/rails/activejob_spec.rb
Lines 310 to 324 in 1eb011b
After investigating, I realized that with Rails >= 7.2, all the test jobs were using
ActiveJob::QueueAdapters::AsyncAdapter
as their queue adapter instead ofActiveJob::QueueAdapters::TestAdapter
. This is likely because of this change that was introduced in Rails 7.2.The fix is easy enough: we simply need to make sure
ActiveJob::TestHelper
is included before the test suite runs. After including the helper module, all test jobs correctly useActiveJob::QueueAdapters::TestAdapter
as their queue adapter.What I don't understand is why this happens locally but not in CI 🤔
#skip-changelog