Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-12-23 18:00:18 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-12-23 18:00:18 +0300
commit6ce82deda34e8af9d07cf7dfff0057f33b9e6187 (patch)
treee88b7ca57376e83556c7a651d61dbe8ba09440b5 /spec/migrations
parent3d62fe7ad9b32c2e68d253d0b2bd178215c65fa5 (diff)
Add latest changes from gitlab-org/gitlab@13-7-stable-ee
Diffstat (limited to 'spec/migrations')
-rw-r--r--spec/migrations/20201110161542_cleanup_transfered_projects_shared_runners_spec.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/migrations/20201110161542_cleanup_transfered_projects_shared_runners_spec.rb b/spec/migrations/20201110161542_cleanup_transfered_projects_shared_runners_spec.rb
new file mode 100644
index 00000000000..8563114c9f9
--- /dev/null
+++ b/spec/migrations/20201110161542_cleanup_transfered_projects_shared_runners_spec.rb
@@ -0,0 +1,32 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+require Rails.root.join('db', 'post_migrate', '20201110161542_cleanup_transfered_projects_shared_runners.rb')
+
+RSpec.describe CleanupTransferedProjectsSharedRunners, :sidekiq, schema: 20201110161542 do
+ let(:namespaces) { table(:namespaces) }
+ let(:migration) { described_class.new }
+ let(:batch_interval) { described_class::INTERVAL }
+
+ let!(:namespace_1) { namespaces.create!(name: 'foo', path: 'foo') }
+ let!(:namespace_2) { namespaces.create!(name: 'bar', path: 'bar') }
+ let!(:namespace_3) { namespaces.create!(name: 'baz', path: 'baz') }
+
+ describe '#up' do
+ before do
+ stub_const("#{described_class}::BATCH_SIZE", 2)
+ end
+
+ it 'schedules ResetSharedRunnersForTransferredProjects background jobs' do
+ Sidekiq::Testing.fake! do
+ freeze_time do
+ migration.up
+
+ expect(BackgroundMigrationWorker.jobs.size).to eq(2)
+ expect(described_class::MIGRATION).to be_scheduled_delayed_migration(batch_interval, namespace_1.id, namespace_2.id)
+ expect(described_class::MIGRATION).to be_scheduled_delayed_migration(batch_interval * 2, namespace_3.id, namespace_3.id)
+ end
+ end
+ end
+ end
+end