debian-mirror-gitlab/spec/migrations/20200122123016_backfill_project_settings_spec.rb

33 lines
1 KiB
Ruby
Raw Normal View History

2020-03-13 15:44:24 +05:30
# frozen_string_literal: true
require 'spec_helper'
2021-09-04 01:27:46 +05:30
require_migration!('backfill_project_settings')
2020-03-13 15:44:24 +05:30
2020-07-28 23:09:34 +05:30
RSpec.describe BackfillProjectSettings, :sidekiq, schema: 20200114113341 do
2020-03-13 15:44:24 +05:30
let(:projects) { table(:projects) }
2021-02-22 17:27:13 +05:30
let(:namespace) { table(:namespaces).create!(name: 'user', path: 'user') }
let(:project) { projects.create!(namespace_id: namespace.id) }
2020-03-13 15:44:24 +05:30
describe '#up' do
before do
stub_const("#{described_class}::BATCH_SIZE", 2)
2021-02-22 17:27:13 +05:30
projects.create!(id: 1, namespace_id: namespace.id)
projects.create!(id: 2, namespace_id: namespace.id)
projects.create!(id: 3, namespace_id: namespace.id)
2020-03-13 15:44:24 +05:30
end
it 'schedules BackfillProjectSettings background jobs' do
Sidekiq::Testing.fake! do
2020-11-24 15:15:51 +05:30
freeze_time do
2020-03-13 15:44:24 +05:30
migrate!
expect(described_class::MIGRATION).to be_scheduled_delayed_migration(2.minutes, 1, 2)
expect(described_class::MIGRATION).to be_scheduled_delayed_migration(4.minutes, 3, 3)
expect(BackgroundMigrationWorker.jobs.size).to eq(2)
end
end
end
end
end