diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 13:16:36 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 13:16:36 +0000 |
commit | 311b0269b4eb9839fa63f80c8d7a58f32b8138a0 (patch) | |
tree | 07e7870bca8aed6d61fdcc810731c50d2c40af47 /spec/services/error_tracking/collect_error_service_spec.rb | |
parent | 27909cef6c4170ed9205afa7426b8d3de47cbb0c (diff) | |
download | gitlab-ce-311b0269b4eb9839fa63f80c8d7a58f32b8138a0.tar.gz |
Add latest changes from gitlab-org/gitlab@14-5-stable-eev14.5.0-rc42
Diffstat (limited to 'spec/services/error_tracking/collect_error_service_spec.rb')
-rw-r--r-- | spec/services/error_tracking/collect_error_service_spec.rb | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/spec/services/error_tracking/collect_error_service_spec.rb b/spec/services/error_tracking/collect_error_service_spec.rb index ee9d0813e64..52d095148c8 100644 --- a/spec/services/error_tracking/collect_error_service_spec.rb +++ b/spec/services/error_tracking/collect_error_service_spec.rb @@ -4,7 +4,8 @@ require 'spec_helper' RSpec.describe ErrorTracking::CollectErrorService do let_it_be(:project) { create(:project) } - let_it_be(:parsed_event) { Gitlab::Json.parse(fixture_file('error_tracking/parsed_event.json')) } + let_it_be(:parsed_event_file) { 'error_tracking/parsed_event.json' } + let_it_be(:parsed_event) { Gitlab::Json.parse(fixture_file(parsed_event_file)) } subject { described_class.new(project, nil, event: parsed_event) } @@ -41,6 +42,14 @@ RSpec.describe ErrorTracking::CollectErrorService do expect(event.payload).to eq parsed_event end + context 'python sdk event' do + let(:parsed_event) { Gitlab::Json.parse(fixture_file('error_tracking/python_event.json')) } + + it 'creates a valid event' do + expect { subject.execute }.to change { ErrorTracking::ErrorEvent.count }.by(1) + end + end + context 'unusual payload' do let(:modified_event) { parsed_event } @@ -64,5 +73,25 @@ RSpec.describe ErrorTracking::CollectErrorService do end end end + + context 'go payload' do + let(:parsed_event) { Gitlab::Json.parse(fixture_file('error_tracking/go_parsed_event.json')) } + + it 'has correct values set' do + subject.execute + + event = ErrorTracking::ErrorEvent.last + error = event.error + + expect(error.name).to eq '*errors.errorString' + expect(error.description).to start_with 'Hello world' + expect(error.platform).to eq 'go' + + expect(event.description).to start_with 'Hello world' + expect(event.level).to eq 'error' + expect(event.environment).to eq 'Accumulate' + expect(event.payload).to eq parsed_event + end + end end end |