You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The test teardown method teardown_sentry_test clears the global event processors Sentry::Scope.global_event_processors. Any application global event processors are wiped after one test.
Reasoning:
The global event processors are by nature global and any setup by the application are cleared. This makes the test setup and teardown process uneven: what is setup before the test is not retained after the teardown of the test.
This method is suggested to be run after every example/test, so this teardown behavior would necessitate running the application setup before every test in order to setup any global event processors.
Also, this PR does not fix the issue that #2051 describes: Sentry.init does not clear the global event processors.
That's never the goal. We don't expect users to call Sentry.init multiple times for testing because it'd mutate the process's states multiple times and cause unwanted side-effects (e.g. registering multiple at_exit callbacks). Therefore, Sentry.init is never designed to clear previous configurations/states.
This is also why we provide the test helper to reset/clean states users may be testing between test runs, so they don't force-reset the values through Sentry.init.
I think the correct fix to this issue is to "restore" instead of "clear" global processors after each run. And I think we may use setup_sentry_test to capture the original value.
Issue Description
The test teardown method
teardown_sentry_test
clears the global event processorsSentry::Scope.global_event_processors
. Any application global event processors are wiped after one test.Reasoning:
This behavior was introduced in #2342.
Reproduction Steps
Expected Behavior
The list of global events processors
Sentry::Scope.global_event_processors
is retained.Actual Behavior
The list of global events processors
Sentry::Scope.global_event_processors
is cleared.Ruby Version
3.3.5
SDK Version
5.21.0
Integration and Its Version
Rails 7.1.4
Sentry Config
No response
The text was updated successfully, but these errors were encountered: