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

Make sure test helper clears the current scope before/after a test #1900

Merged
merged 2 commits into from
Sep 20, 2022

Conversation

st0012
Copy link
Collaborator

@st0012 st0012 commented Sep 17, 2022

Because the setup_sentry_test helper provides a clean client, the scope should be clean too. I also imagine teardown_sentry_test includes clearing the current scope's contextual data.

And because there's not a bind_client equivalent API for scope, we clear the scope's value with Scope#clear instead of creating a new scope. But in practice that both of them should work the same.

@st0012 st0012 added this to the 5.5.0 milestone Sep 17, 2022
@st0012 st0012 self-assigned this Sep 17, 2022
@st0012 st0012 added this to In progress in 5.x via automation Sep 17, 2022
@codecov-commenter
Copy link

Codecov Report

Base: 98.40% // Head: 98.41% // Increases project coverage by +0.01% 🎉

Coverage data is based on head (65b7f9a) compared to base (ae13d7d).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1900      +/-   ##
==========================================
+ Coverage   98.40%   98.41%   +0.01%     
==========================================
  Files         148      148              
  Lines        8891     8897       +6     
==========================================
+ Hits         8749     8756       +7     
+ Misses        142      141       -1     
Impacted Files Coverage Δ
sentry-ruby/lib/sentry/test_helper.rb 100.00% <100.00%> (ø)
sentry-ruby/spec/sentry/test_helper_spec.rb 100.00% <100.00%> (ø)
sentry-resque/lib/sentry/resque.rb 100.00% <0.00%> (+2.85%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link

@francois-ferrandis francois-ferrandis left a comment

Choose a reason for hiding this comment

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

Looks good, thank you!

Because the `setup_sentry_test` helper provides a clean client, the
scope should be clean too. I also imagine `teardown_sentry_test`
includes clearing the current scope's contextual data.

And because there's not a `bind_client` equivalent API for scope, we
clear the scope's value with `Scope#clear` instead of creating a new
scope. But in practice that both of them should work the same.
@st0012 st0012 merged commit e18ce4b into master Sep 20, 2022
5.x automation moved this from In progress to Done Sep 20, 2022
@st0012 st0012 deleted the fix-#1881 branch September 20, 2022 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
5.x
Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants