summaryrefslogtreecommitdiff
path: root/spec/migrations
diff options
context:
space:
mode:
authorOswaldo Ferreira <oswaldo@gitlab.com>2018-07-04 16:06:30 -0300
committerOswaldo Ferreira <oswaldo@gitlab.com>2018-07-10 09:43:58 -0300
commit4455904bc154f1a36cedeea574bb0f454f92a9e9 (patch)
tree7484b5e155ffb386cf87684f76d3a8bfe98c4c8d /spec/migrations
parente66535e8407ccb8dd229fefdce817902a364f58a (diff)
downloadgitlab-ce-4455904bc154f1a36cedeea574bb0f454f92a9e9.tar.gz
Add 1000 files per minute deletion ratio on scheduler
Diffstat (limited to 'spec/migrations')
-rw-r--r--spec/migrations/enqueue_delete_diff_files_workers_spec.rb39
1 files changed, 5 insertions, 34 deletions
diff --git a/spec/migrations/enqueue_delete_diff_files_workers_spec.rb b/spec/migrations/enqueue_delete_diff_files_workers_spec.rb
index 43dbd7e8f53..3d19c6fcc10 100644
--- a/spec/migrations/enqueue_delete_diff_files_workers_spec.rb
+++ b/spec/migrations/enqueue_delete_diff_files_workers_spec.rb
@@ -2,45 +2,16 @@ require 'spec_helper'
require Rails.root.join('db', 'post_migrate', '20180619121030_enqueue_delete_diff_files_workers.rb')
describe EnqueueDeleteDiffFilesWorkers, :migration, :sidekiq do
- let(:merge_request_diffs) { table(:merge_request_diffs) }
- let(:merge_requests) { table(:merge_requests) }
- let(:namespaces) { table(:namespaces) }
- let(:projects) { table(:projects) }
-
- before do
- stub_const("#{described_class.name}::BATCH_SIZE", 4)
-
- namespaces.create!(id: 1, name: 'gitlab', path: 'gitlab')
- projects.create!(id: 1, namespace_id: 1, name: 'gitlab', path: 'gitlab')
-
- merge_requests.create!(id: 1, target_project_id: 1, source_project_id: 1, target_branch: 'feature', source_branch: 'master', state: 'merged')
-
- merge_request_diffs.create!(id: 1, merge_request_id: 1, state: 'collected')
- merge_request_diffs.create!(id: 2, merge_request_id: 1, state: 'without_files')
- merge_request_diffs.create!(id: 3, merge_request_id: 1, state: 'collected')
- merge_request_diffs.create!(id: 4, merge_request_id: 1, state: 'collected')
- merge_request_diffs.create!(id: 5, merge_request_id: 1, state: 'empty')
- merge_request_diffs.create!(id: 6, merge_request_id: 1, state: 'collected')
- merge_request_diffs.create!(id: 7, merge_request_id: 1, state: 'collected')
-
- merge_requests.update(1, latest_merge_request_diff_id: 6)
- end
-
- it 'correctly schedules diff file deletion workers schedulers' do
+ it 'correctly schedules diff file deletion scheduler' do
Sidekiq::Testing.fake! do
- # First scheduling batch
- expect(BackgroundMigrationWorker).to receive(:perform_async)
- .with(described_class::SCHEDULER, [[[1], [3], [4], [6]], 1])
- .and_call_original
-
- # Second scheduling batch
- expect(BackgroundMigrationWorker).to receive(:perform_async)
- .with(described_class::SCHEDULER, [[[7]], 2])
+ expect(BackgroundMigrationWorker)
+ .to receive(:perform_async)
+ .with(described_class::SCHEDULER)
.and_call_original
migrate!
- expect(BackgroundMigrationWorker.jobs.size).to eq(2)
+ expect(BackgroundMigrationWorker.jobs.size).to eq(1)
end
end
end