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-05-29 21:08:26 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-05-29 21:08:26 +0300
commitb64a8161c9442d82897a341d6bf935dd3e748b06 (patch)
treeb9953db8607d1393aa8ac588a15f184dd8e183f6 /spec/migrations
parent6e33325c1458cb31b4d36a7eec817fa00ec3faaf (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/migrations')
-rw-r--r--spec/migrations/seed_repository_storages_weighted_spec.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/migrations/seed_repository_storages_weighted_spec.rb b/spec/migrations/seed_repository_storages_weighted_spec.rb
new file mode 100644
index 00000000000..9a68ff5fb2f
--- /dev/null
+++ b/spec/migrations/seed_repository_storages_weighted_spec.rb
@@ -0,0 +1,31 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+require Rails.root.join('db', 'post_migrate', '20200526000407_seed_repository_storages_weighted.rb')
+
+describe SeedRepositoryStoragesWeighted do
+ let(:storages) { { "foo" => {}, "baz" => {} } }
+ let(:application_settings) do
+ table(:application_settings).tap do |klass|
+ klass.class_eval do
+ serialize :repository_storages
+ end
+ end
+ end
+
+ before do
+ allow(Gitlab.config.repositories).to receive(:storages).and_return(storages)
+ end
+
+ let(:application_setting) { application_settings.create }
+ let(:repository_storages) { ["foo"] }
+
+ it 'correctly schedules background migrations' do
+ application_setting.repository_storages = repository_storages
+ application_setting.save!
+
+ migrate!
+
+ expect(application_settings.find(application_setting.id).repository_storages_weighted).to eq({ "foo" => 100, "baz" => 0 })
+ end
+end