diff options
| author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2019-05-14 21:36:03 +0000 |
|---|---|---|
| committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2019-05-14 21:36:03 +0000 |
| commit | 36e15a866df5ca70e9c8209925acad412f2c6538 (patch) | |
| tree | ff75fee6c905fecb6b21189587e19089f50177bc /spec | |
| parent | 6e7b14bc32831ef7efd463d59657e232bd9887a8 (diff) | |
| parent | 4c2f6814907f3988c86c9f79a155d1d48ba61793 (diff) | |
| download | gitlab-ce-36e15a866df5ca70e9c8209925acad412f2c6538.tar.gz | |
Merge branch 'bvl-add-corrilation-id-to-all-exception' into 'master'
Add correlation id to all sentry errors
Closes #61699
See merge request gitlab-org/gitlab-ce!28253
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/lib/gitlab/sentry_spec.rb | 5 | ||||
| -rw-r--r-- | spec/requests/api/helpers_spec.rb | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/spec/lib/gitlab/sentry_spec.rb b/spec/lib/gitlab/sentry_spec.rb index ae522a588ee..af8b059b984 100644 --- a/spec/lib/gitlab/sentry_spec.rb +++ b/spec/lib/gitlab/sentry_spec.rb @@ -2,12 +2,15 @@ require 'spec_helper' describe Gitlab::Sentry do describe '.context' do - it 'adds the locale to the tags' do + it 'adds the expected tags' do expect(described_class).to receive(:enabled?).and_return(true) + allow(Labkit::Correlation::CorrelationId).to receive(:current_id).and_return('cid') described_class.context(nil) expect(Raven.tags_context[:locale].to_s).to eq(I18n.locale.to_s) + expect(Raven.tags_context[Labkit::Correlation::CorrelationId::LOG_KEY.to_sym].to_s) + .to eq('cid') end end diff --git a/spec/requests/api/helpers_spec.rb b/spec/requests/api/helpers_spec.rb index 25a312cb734..ed907841bd8 100644 --- a/spec/requests/api/helpers_spec.rb +++ b/spec/requests/api/helpers_spec.rb @@ -247,9 +247,8 @@ describe API::Helpers do exception = RuntimeError.new('test error') allow(exception).to receive(:backtrace).and_return(caller) - expect(Raven).to receive(:capture_exception).with(exception, tags: { - correlation_id: 'new-correlation-id' - }, extra: {}) + expect(Raven).to receive(:capture_exception).with(exception, tags: + a_hash_including(correlation_id: 'new-correlation-id'), extra: {}) Labkit::Correlation::CorrelationId.use_id('new-correlation-id') do handle_api_exception(exception) |
