diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-10 15:06:19 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-10 15:06:19 +0300 |
commit | 69849c280c5525d132ebaddb1200c390a42ecc06 (patch) | |
tree | 2c6ffc6fd6dc4fa719305f25b475391730389747 /spec/migrations | |
parent | c157f963db87a40a3ba7b94b339530ee83194bc8 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/migrations')
-rw-r--r-- | spec/migrations/schedule_pages_metadata_migration_spec.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/migrations/schedule_pages_metadata_migration_spec.rb b/spec/migrations/schedule_pages_metadata_migration_spec.rb new file mode 100644 index 00000000000..100ed520a32 --- /dev/null +++ b/spec/migrations/schedule_pages_metadata_migration_spec.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +require 'spec_helper' +require Rails.root.join('db', 'post_migrate', '20191002031332_schedule_pages_metadata_migration') + +describe SchedulePagesMetadataMigration, :migration, :sidekiq do + 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 + Timecop.freeze do + 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 |