diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-19 01:45:44 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-19 01:45:44 +0000 |
commit | 85dc423f7090da0a52c73eb66faf22ddb20efff9 (patch) | |
tree | 9160f299afd8c80c038f08e1545be119f5e3f1e1 /db/fixtures | |
parent | 15c2c8c66dbe422588e5411eee7e68f1fa440bb8 (diff) | |
download | gitlab-ce-85dc423f7090da0a52c73eb66faf22ddb20efff9.tar.gz |
Add latest changes from gitlab-org/gitlab@13-4-stable-ee
Diffstat (limited to 'db/fixtures')
-rw-r--r-- | db/fixtures/development/01_admin.rb | 3 | ||||
-rw-r--r-- | db/fixtures/development/02_users.rb | 12 | ||||
-rw-r--r-- | db/fixtures/development/21_dev_ops_report_metrics.rb (renamed from db/fixtures/development/21_dev_ops_score_metrics.rb) | 6 | ||||
-rw-r--r-- | db/fixtures/development/26_packages.rb | 8 | ||||
-rw-r--r-- | db/fixtures/development/29_instance_statistics.rb | 25 | ||||
-rw-r--r-- | db/fixtures/development/98_gitlab_instance_administration_project.rb | 10 | ||||
-rw-r--r-- | db/fixtures/production/998_gitlab_instance_administration_project.rb | 10 |
7 files changed, 64 insertions, 10 deletions
diff --git a/db/fixtures/development/01_admin.rb b/db/fixtures/development/01_admin.rb index 46b114dd07b..b4778a6ecbd 100644 --- a/db/fixtures/development/01_admin.rb +++ b/db/fixtures/development/01_admin.rb @@ -7,7 +7,8 @@ Gitlab::Seeder.quiet do username: 'root', password: '5iveL!fe', admin: true, - confirmed_at: DateTime.now + confirmed_at: DateTime.now, + password_expires_at: DateTime.now ) print '.' diff --git a/db/fixtures/development/02_users.rb b/db/fixtures/development/02_users.rb index 909d10cbb40..7916cdd5fb1 100644 --- a/db/fixtures/development/02_users.rb +++ b/db/fixtures/development/02_users.rb @@ -22,7 +22,7 @@ class Gitlab::Seeder::Users private def create_mass_users! - encrypted_password = Devise::Encryptor.digest(User, '12345678') + encrypted_password = Devise::Encryptor.digest(User, random_password) Gitlab::Seeder.with_mass_insert(MASS_USERS_COUNT, User) do ActiveRecord::Base.connection.execute <<~SQL @@ -49,6 +49,10 @@ class Gitlab::Seeder::Users FROM users WHERE NOT admin SQL end + + puts '===========================================================' + puts "INFO: Password for newly created users is: #{random_password}" + puts '===========================================================' end def create_random_users! @@ -59,7 +63,7 @@ class Gitlab::Seeder::Users name: FFaker::Name.name, email: FFaker::Internet.email, confirmed_at: DateTime.now, - password: '12345678' + password: random_password ) print '.' @@ -68,6 +72,10 @@ class Gitlab::Seeder::Users end end end + + def random_password + @random_password ||= SecureRandom.hex.slice(0,16) + end end Gitlab::Seeder.quiet do diff --git a/db/fixtures/development/21_dev_ops_score_metrics.rb b/db/fixtures/development/21_dev_ops_report_metrics.rb index afea7fb4bd0..8b4956da37e 100644 --- a/db/fixtures/development/21_dev_ops_score_metrics.rb +++ b/db/fixtures/development/21_dev_ops_report_metrics.rb @@ -1,5 +1,5 @@ Gitlab::Seeder.quiet do - dev_ops_score_metric = DevOpsScore::Metric.new( + dev_ops_report_metric = DevOpsReport::Metric.new( leader_issues: 10.2, instance_issues: 3.2, @@ -31,10 +31,10 @@ Gitlab::Seeder.quiet do instance_service_desk_issues: 15.1 ) - if dev_ops_score_metric.save + if dev_ops_report_metric.save print '.' else - puts dev_ops_score_metric.errors.full_messages + puts dev_ops_report_metric.errors.full_messages print 'F' end end diff --git a/db/fixtures/development/26_packages.rb b/db/fixtures/development/26_packages.rb index 6096fd8962a..2a7f80c18a3 100644 --- a/db/fixtures/development/26_packages.rb +++ b/db/fixtures/development/26_packages.rb @@ -21,7 +21,7 @@ class Gitlab::Seeder::Packages .gsub('1.0.1', version)) .with_indifferent_access - ::Packages::Npm::CreatePackageService.new(project, project.owner, params).execute + ::Packages::Npm::CreatePackageService.new(project, project.creator, params).execute print '.' end @@ -38,7 +38,7 @@ class Gitlab::Seeder::Packages path: "#{name}/#{version}" } - pkg = ::Packages::Maven::CreatePackageService.new(project, project.owner, params).execute + pkg = ::Packages::Maven::CreatePackageService.new(project, project.creator, params).execute %w(maven-metadata.xml my-app-1.0-20180724.124855-1.pom my-app-1.0-20180724.124855-1.jar).each do |filename| with_cloned_fixture_file('maven', filename) do |filepath| @@ -68,7 +68,7 @@ class Gitlab::Seeder::Packages package_channel: 'stable' } - pkg = ::Packages::Conan::CreatePackageService.new(project, project.owner, params).execute + pkg = ::Packages::Conan::CreatePackageService.new(project, project.creator, params).execute fixtures = { 'recipe_files' => %w(conanfile.py conanmanifest.txt), @@ -103,7 +103,7 @@ class Gitlab::Seeder::Packages name = "MyNugetApp.Package#{i}" version = "4.2.#{i}" - pkg = ::Packages::Nuget::CreatePackageService.new(project, project.owner, {}).execute + pkg = ::Packages::Nuget::CreatePackageService.new(project, project.creator, {}).execute # when using ::Packages::Nuget::CreatePackageService, packages have a fixed name and a fixed version. pkg.update!(name: name, version: version) diff --git a/db/fixtures/development/29_instance_statistics.rb b/db/fixtures/development/29_instance_statistics.rb new file mode 100644 index 00000000000..c4af13d0f4d --- /dev/null +++ b/db/fixtures/development/29_instance_statistics.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +require './spec/support/sidekiq_middleware' + +Gitlab::Seeder.quiet do + model_class = Analytics::InstanceStatistics::Measurement + recorded_at = Date.today + + # Insert random counts for the last 10 weeks + measurements = 10.times.flat_map do + recorded_at = (recorded_at - 1.week).end_of_week.end_of_day - 5.minutes + + model_class.identifiers.map do |_, id| + { + recorded_at: recorded_at, + count: rand(1_000_000), + identifier: id + } + end + end + + model_class.upsert_all(measurements, unique_by: [:identifier, :recorded_at]) + + print '.' +end diff --git a/db/fixtures/development/98_gitlab_instance_administration_project.rb b/db/fixtures/development/98_gitlab_instance_administration_project.rb new file mode 100644 index 00000000000..8be707ffb08 --- /dev/null +++ b/db/fixtures/development/98_gitlab_instance_administration_project.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +response = ::Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService.new.execute + +if response[:status] == :success + puts "Successfully created self monitoring project." +else + puts "Could not create self monitoring project due to error: '#{response[:message]}'" + puts "Check logs for more details." +end diff --git a/db/fixtures/production/998_gitlab_instance_administration_project.rb b/db/fixtures/production/998_gitlab_instance_administration_project.rb new file mode 100644 index 00000000000..8be707ffb08 --- /dev/null +++ b/db/fixtures/production/998_gitlab_instance_administration_project.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +response = ::Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService.new.execute + +if response[:status] == :success + puts "Successfully created self monitoring project." +else + puts "Could not create self monitoring project due to error: '#{response[:message]}'" + puts "Check logs for more details." +end |