summaryrefslogtreecommitdiff
path: root/spec/migrations
diff options
context:
space:
mode:
Diffstat (limited to 'spec/migrations')
-rw-r--r--spec/migrations/enqueue_delete_diff_files_workers_spec.rb24
1 files changed, 16 insertions, 8 deletions
diff --git a/spec/migrations/enqueue_delete_diff_files_workers_spec.rb b/spec/migrations/enqueue_delete_diff_files_workers_spec.rb
index 686027822b8..52d6e9b2c64 100644
--- a/spec/migrations/enqueue_delete_diff_files_workers_spec.rb
+++ b/spec/migrations/enqueue_delete_diff_files_workers_spec.rb
@@ -8,7 +8,7 @@ describe EnqueueDeleteDiffFilesWorkers, :migration, :sidekiq do
let(:projects) { table(:projects) }
before do
- stub_const("#{described_class.name}::BATCH_SIZE", 2)
+ stub_const("#{described_class.name}::BATCH_SIZE", 7)
namespaces.create!(id: 1, name: 'gitlab', path: 'gitlab')
projects.create!(id: 1, namespace_id: 1, name: 'gitlab', path: 'gitlab')
@@ -21,6 +21,10 @@ describe EnqueueDeleteDiffFilesWorkers, :migration, :sidekiq do
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_request_diffs.create!(id: 8, merge_request_id: 1, state: 'collected')
+ merge_request_diffs.create!(id: 9, merge_request_id: 1, state: 'collected')
+ merge_request_diffs.create!(id: 10, merge_request_id: 1, state: 'collected')
merge_requests.update(1, latest_merge_request_diff_id: 6)
end
@@ -30,13 +34,17 @@ describe EnqueueDeleteDiffFilesWorkers, :migration, :sidekiq do
Timecop.freeze do
migrate!
- # 1st batch
- expect(described_class::MIGRATION).to be_scheduled_delayed_migration(8.minutes, 1)
- expect(described_class::MIGRATION).to be_scheduled_delayed_migration(9.minutes, 3)
- # 2nd batch
- expect(described_class::MIGRATION).to be_scheduled_delayed_migration(16.minutes, 4)
- expect(described_class::MIGRATION).to be_scheduled_delayed_migration(17.minutes, 6)
- expect(BackgroundMigrationWorker.jobs.size).to eq(4)
+ # 1st batch schedule
+ [1, 3, 4, 6, 7].each do |id|
+ expect(described_class::MIGRATION).to be_scheduled_delayed_migration(10.minutes, id)
+ end
+ [8, 9].each do |id|
+ expect(described_class::MIGRATION).to be_scheduled_delayed_migration(11.minutes, id)
+ end
+
+ # 2nd batch schedule
+ expect(described_class::MIGRATION).to be_scheduled_delayed_migration(20.minutes, 10)
+ expect(BackgroundMigrationWorker.jobs.size).to eq(8)
end
end
end