debian-mirror-gitlab/spec/migrations/schedule_pages_metadata_migration_spec.rb

30 lines
884 B
Ruby
Raw Normal View History

2019-12-21 20:55:43 +05:30
# frozen_string_literal: true
require 'spec_helper'
2021-09-04 01:27:46 +05:30
require_migration!
2019-12-21 20:55:43 +05:30
2020-07-28 23:09:34 +05:30
RSpec.describe SchedulePagesMetadataMigration do
2019-12-21 20:55:43 +05:30
let(:namespaces) { table(:namespaces) }
let(:projects) { table(:projects) }
before do
stub_const("#{described_class.name}::BATCH_SIZE", 1)
namespaces.create!(id: 11, name: 'gitlab', path: 'gitlab-org')
projects.create!(id: 111, namespace_id: 11, name: 'Project 111')
projects.create!(id: 114, namespace_id: 11, name: 'Project 114')
end
it 'schedules pages metadata migration' do
Sidekiq::Testing.fake! do
2020-11-24 15:15:51 +05:30
freeze_time do
2019-12-21 20:55:43 +05:30
migrate!
expect(described_class::MIGRATION).to be_scheduled_delayed_migration(2.minutes, 111, 111)
expect(described_class::MIGRATION).to be_scheduled_delayed_migration(4.minutes, 114, 114)
expect(BackgroundMigrationWorker.jobs.size).to eq(2)
end
end
end
end