diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
commit | b76ae638462ab0f673e5915986070518dd3f9ad3 (patch) | |
tree | bdab0533383b52873be0ec0eb4d3c66598ff8b91 /db/fixtures | |
parent | 434373eabe7b4be9593d18a585fb763f1e5f1a6f (diff) |
Add latest changes from gitlab-org/gitlab@14-2-stable-eev14.2.0-rc42
Diffstat (limited to 'db/fixtures')
-rw-r--r-- | db/fixtures/development/17_cycle_analytics.rb | 2 | ||||
-rw-r--r-- | db/fixtures/development/31_error_tracking.rb | 49 |
2 files changed, 50 insertions, 1 deletions
diff --git a/db/fixtures/development/17_cycle_analytics.rb b/db/fixtures/development/17_cycle_analytics.rb index 826e703a443..95d956fb402 100644 --- a/db/fixtures/development/17_cycle_analytics.rb +++ b/db/fixtures/development/17_cycle_analytics.rb @@ -149,7 +149,7 @@ class Gitlab::Seeder::CycleAnalytics email: "vsm-user-#{i}@#{suffix}.com" ) - project.group.add_developer(user) + project.group&.add_developer(user) project.add_developer(user) @developers << user diff --git a/db/fixtures/development/31_error_tracking.rb b/db/fixtures/development/31_error_tracking.rb new file mode 100644 index 00000000000..60e288696f8 --- /dev/null +++ b/db/fixtures/development/31_error_tracking.rb @@ -0,0 +1,49 @@ +# frozen_string_literal: true + +class Gitlab::Seeder::ErrorTrackingSeeder + attr_reader :project + + def initialize(project) + @project = project + end + + def seed + parsed_event = Gitlab::Json.parse(read_fixture_file('parsed_event.json')) + + ErrorTracking::CollectErrorService + .new(project, nil, event: parsed_event) + .execute + end + + private + + def read_fixture_file(file) + File.read(fixture_path(file)) + end + + def fixture_path(file) + Rails.root.join('spec', 'fixtures', 'error_tracking', file) + end +end + + +Gitlab::Seeder.quiet do + admin_user = User.admins.first + + Project.not_mass_generated.visible_to_user(admin_user).sample(1).each do |project| + puts "\nActivating integrated error tracking for the '#{project.full_path}' project" + + unless Feature.enabled?(:integrated_error_tracking, project) + puts '- enabling feature flag' + Feature.enable(:integrated_error_tracking, project) + end + + puts '- enabling in settings' + project.error_tracking_setting || project.create_error_tracking_setting + project.error_tracking_setting.update!(enabled: true, integrated: true) + + puts '- seeding an error' + seeder = Gitlab::Seeder::ErrorTrackingSeeder.new(project) + seeder.seed + end +end |