diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-19 14:01:45 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-19 14:01:45 +0300 |
commit | 9297025d0b7ddf095eb618dfaaab2ff8f2018d8b (patch) | |
tree | 865198c01d1824a9b098127baa3ab980c9cd2c06 /spec/lib/gitlab/error_tracking_spec.rb | |
parent | 6372471f43ee03c05a7c1f8b0c6ac6b8a7431dbe (diff) |
Add latest changes from gitlab-org/gitlab@16-7-stable-eev16.7.0-rc42
Diffstat (limited to 'spec/lib/gitlab/error_tracking_spec.rb')
-rw-r--r-- | spec/lib/gitlab/error_tracking_spec.rb | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/spec/lib/gitlab/error_tracking_spec.rb b/spec/lib/gitlab/error_tracking_spec.rb index 79016335a40..c9b2e21d934 100644 --- a/spec/lib/gitlab/error_tracking_spec.rb +++ b/spec/lib/gitlab/error_tracking_spec.rb @@ -97,6 +97,27 @@ RSpec.describe Gitlab::ErrorTracking, feature_category: :shared do ) end.to raise_error(RuntimeError, /boom/) end + + context 'with tags' do + let(:tags) { { 'mytag' => 2 } } + + before do + sentry_payload[:tags].merge!(tags) + end + + it 'includes additional tags' do + expect(Raven).to receive(:capture_exception).with(exception, sentry_payload) + expect(Sentry).to receive(:capture_exception).with(exception, sentry_payload) + + expect do + described_class.track_and_raise_for_dev_exception( + exception, + { issue_url: issue_url, some_other_info: 'info' }, + tags + ) + end.to raise_error(RuntimeError, /boom/) + end + end end context 'when exceptions for dev should not be raised' do @@ -181,8 +202,10 @@ RSpec.describe Gitlab::ErrorTracking, feature_category: :shared do end describe '.track_exception' do + let(:tags) { {} } + subject(:track_exception) do - described_class.track_exception(exception, extra) + described_class.track_exception(exception, extra, tags) end before do @@ -207,6 +230,18 @@ RSpec.describe Gitlab::ErrorTracking, feature_category: :shared do expect(Gitlab::ErrorTracking::Logger).to have_received(:error).with(logger_payload) end + context 'with tags' do + let(:tags) { { 'mytag' => 2 } } + + it 'includes the tags' do + track_exception + + expect(Gitlab::ErrorTracking::Logger).to have_received(:error).with( + hash_including({ 'tags.mytag' => 2 }) + ) + end + end + context 'with filterable parameters' do let(:extra) { { test: 1, my_token: 'test' } } |