Closed amo13 closed 5 months ago
this is because we patch active job and thus the sentry stuff runs before your assert_raises
https://github.com/getsentry/sentry-ruby/blob/100caa0dc679c4e53564b32a56eee335f61f615f/sentry-rails/lib/sentry/rails/active_job.rb#L4-L12
You can manually set config.enabled_environments = %w[development production]
, does so that sentry does not send in test, does that work for you or do you need to disable just this one usage?
edit: nvm sorry didn't read that you still want to send uncaught exceptions in tests.
Then your next best way is to use config.before_send
and filter out those particular exceptions.
https://docs.sentry.io/platforms/ruby/configuration/filtering/#using-
Thank you a lot for clarifying this!
I do not understand why my test cases following this pattern send exceptions to sentry. The
assert_raises
statement rescues the exception and does not reraise it. How can it still slip through and be reported to the sentry server? And what do I need to change to a) prevent these job tests to send report exception correctly caught by the assert_raises helper, and b) still report uncaught exceptions in the test environment?I can't imagine that this happens because I have configured GoodJob which is not supported by this gem because the tests use the test adapter anyway. Any guidance with this would be greatly appreciated.