Repository navigation
fix(test-helper): restore application event processors after tests - #3205
Open
itsrayeedscodespace wants to merge 1 commit into
Open
itsrayeedscodespace wants to merge 1 commit into
itsrayeedscodespace wants to merge 1 commit into
Conversation
Snapshot global event processors before test setup and restore them during teardown, retaining application processors while removing per-test additions. Cover successive tests, removed processors, and setup-block additions. Co-Authored-By: GPT-6 <gpt-6@noreply.example.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
teardown_sentry_testclears every global event processor, including processors installed by the application before testing. After the first example, subsequent examples silently stop applying those processors.Snapshot the processor list in
setup_sentry_test, before running its customization block, and restore it in teardown. This follows the snapshot/restore approach suggested in #2466. Restoring withArray#replacealso preserves the existing array's identity. Processors added during an example or the setup block are removed; application processors removed during the example are restored.Regression specs exercise successive setup/teardown cycles and assert on captured event tags, processor removal, and array identity. On unchanged master, the two preservation/restoration regressions fail because teardown leaves an empty processor list. All examples pass with this change.
Validation on Ruby 3.4.12, using the committed
ruby-3.4_rack-3_redis-4test-matrix cell:mise exec ruby@3.4 -- ruby bin/test --cell sentry-ruby/gemfiles/ruby-3.4_rack-3_redis-4.gemfile --rake: 1,669 core examples, zero failures, three version-dependent skips; 44 isolated examples, zero failuresmise run --skip-tools --tool ruby@3.4 lint sentry-ruby/lib/sentry/test_helper.rb sentry-ruby/spec/sentry/test_helper_spec.rb: no offensesgit diff --checkFixes #2466