diff options
Diffstat (limited to 'spec/factories/error_tracking')
-rw-r--r-- | spec/factories/error_tracking/client_key.rb | 12 | ||||
-rw-r--r-- | spec/factories/error_tracking/detailed_error.rb | 2 | ||||
-rw-r--r-- | spec/factories/error_tracking/error.rb | 18 | ||||
-rw-r--r-- | spec/factories/error_tracking/error_event.rb | 13 |
4 files changed, 42 insertions, 3 deletions
diff --git a/spec/factories/error_tracking/client_key.rb b/spec/factories/error_tracking/client_key.rb new file mode 100644 index 00000000000..eb5acc8dab7 --- /dev/null +++ b/spec/factories/error_tracking/client_key.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +FactoryBot.define do + factory :error_tracking_client_key, class: 'ErrorTracking::ClientKey' do + project + active { true } + + trait :disabled do + active { false } + end + end +end diff --git a/spec/factories/error_tracking/detailed_error.rb b/spec/factories/error_tracking/detailed_error.rb index 83004ffae38..c2e5741b150 100644 --- a/spec/factories/error_tracking/detailed_error.rb +++ b/spec/factories/error_tracking/detailed_error.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true FactoryBot.define do - factory :detailed_error_tracking_error, parent: :error_tracking_error, class: 'Gitlab::ErrorTracking::DetailedError' do + factory :error_tracking_sentry_detailed_error, parent: :error_tracking_sentry_error, class: 'Gitlab::ErrorTracking::DetailedError' do gitlab_issue { 'http://gitlab.example.com/issues/1' } external_base_url { 'http://example.com' } first_release_last_commit { '68c914da9' } diff --git a/spec/factories/error_tracking/error.rb b/spec/factories/error_tracking/error.rb index e5f2e2ca9a7..bebdffb3614 100644 --- a/spec/factories/error_tracking/error.rb +++ b/spec/factories/error_tracking/error.rb @@ -1,7 +1,8 @@ # frozen_string_literal: true FactoryBot.define do - factory :error_tracking_error, class: 'Gitlab::ErrorTracking::Error' do + # There is an issue to rename this class https://gitlab.com/gitlab-org/gitlab/-/issues/323342. + factory :error_tracking_sentry_error, class: 'Gitlab::ErrorTracking::Error' do id { '1' } title { 'title' } type { 'error' } @@ -25,4 +26,19 @@ FactoryBot.define do skip_create end + + factory :error_tracking_error, class: 'ErrorTracking::Error' do + project + name { 'ActionView::MissingTemplate' } + description { 'Missing template posts/edit' } + actor { 'PostsController#edit' } + platform { 'ruby' } + first_seen_at { Time.now.iso8601 } + last_seen_at { Time.now.iso8601 } + status { 'unresolved' } + + trait :resolved do + status { 'resolved' } + end + end end diff --git a/spec/factories/error_tracking/error_event.rb b/spec/factories/error_tracking/error_event.rb index 880fdf17fae..9620e3999d6 100644 --- a/spec/factories/error_tracking/error_event.rb +++ b/spec/factories/error_tracking/error_event.rb @@ -1,7 +1,8 @@ # frozen_string_literal: true FactoryBot.define do - factory :error_tracking_error_event, class: 'Gitlab::ErrorTracking::ErrorEvent' do + # There is an issue to rename this class https://gitlab.com/gitlab-org/gitlab/-/issues/323342. + factory :error_tracking_sentry_error_event, class: 'Gitlab::ErrorTracking::ErrorEvent' do issue_id { 'id' } date_received { Time.now.iso8601 } stack_trace_entries do @@ -53,4 +54,14 @@ FactoryBot.define do skip_create end + + factory :error_tracking_error_event, class: 'ErrorTracking::ErrorEvent' do + error factory: :error_tracking_error + + description { 'ActionView::MissingTemplate' } + environment { 'development' } + level { 'error' } + occurred_at { Time.now.iso8601 } + payload { Gitlab::Json.parse(File.read(Rails.root.join('spec/fixtures/', 'error_tracking/parsed_event.json'))) } + end end |