summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorTimothy Andrew <mail@timothyandrew.net>2016-09-14 19:40:31 +0530
committerTimothy Andrew <mail@timothyandrew.net>2016-09-14 19:40:31 +0530
commit74626106bb688b0b76b30fc00a71627d94806b3a (patch)
tree6f9699f335f2a900ee7ac7d21df0339e1569b79c /db
parent2110989fe360c2c3a31adc7272524ab83f37de83 (diff)
downloadgitlab-ce-74626106bb688b0b76b30fc00a71627d94806b3a.tar.gz
wip: perf
Diffstat (limited to 'db')
-rw-r--r--db/fixtures/development/17_cycle_analytics.rb30
1 files changed, 15 insertions, 15 deletions
diff --git a/db/fixtures/development/17_cycle_analytics.rb b/db/fixtures/development/17_cycle_analytics.rb
index 5625709af9a..6d5a28c2e81 100644
--- a/db/fixtures/development/17_cycle_analytics.rb
+++ b/db/fixtures/development/17_cycle_analytics.rb
@@ -1,9 +1,10 @@
require 'sidekiq/testing'
class Gitlab::Seeder::CycleAnalytics
- def initialize(project)
+ def initialize(project, perf: false)
@project = project
@user = User.find(1)
+ @issue_count = perf ? 1000 : 5
stub_git_pre_receive!
end
@@ -27,32 +28,26 @@ class Gitlab::Seeder::CycleAnalytics
# Stage 1
Timecop.travel 5.days.from_now
add_milestones_and_list_labels(issues)
- Timecop.return
# Stage 2
- Timecop.travel 10.days.from_now
+ Timecop.travel 5.days.from_now
branches = mention_in_commits(issues)
- Timecop.return
# Stage 3
- Timecop.travel 15.days.from_now
+ Timecop.travel 5.days.from_now
merge_requests = create_merge_requests_closing_issues(issues, branches)
- Timecop.return
# Stage 4
- Timecop.travel 20.days.from_now
+ Timecop.travel 5.days.from_now
run_builds(merge_requests)
- Timecop.return
# Stage 5
- Timecop.travel 25.days.from_now
+ Timecop.travel 5.days.from_now
merge_merge_requests(merge_requests)
- Timecop.return
# Stage 6 / 7
- Timecop.travel 30.days.from_now
+ Timecop.travel 5.days.from_now
deploy_to_production(merge_requests)
- Timecop.return
end
print '.'
@@ -61,7 +56,7 @@ class Gitlab::Seeder::CycleAnalytics
private
def create_issues(project)
- Array.new(5) do
+ Array.new(@issue_count) do
issue_params = {
title: "Cycle Analytics: #{FFaker::Lorem.sentence(6)}",
description: FFaker::Lorem.sentence,
@@ -166,8 +161,13 @@ class Gitlab::Seeder::CycleAnalytics
end
Gitlab::Seeder.quiet do
- Project.all.each do |project|
- seeder = Gitlab::Seeder::CycleAnalytics.new(project)
+ if ENV['SEED_CYCLE_ANALYTICS']
+ seeder = Gitlab::Seeder::CycleAnalytics.new(Project.find(1))
+ seeder.seed!
+ elsif ENV['CYCLE_ANALYTICS_PERF_TEST']
+ seeder = Gitlab::Seeder::CycleAnalytics.new(Project.first, perf: true)
seeder.seed!
+ else
+ puts "Not running the cycle analytics seed file. Use the `SEED_CYCLE_ANALYTICS` environment variable to enable it."
end
end