diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-21 18:08:07 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-21 18:08:07 +0300 |
commit | 61d7d07541aafcf49a97159a6048cf6847adbd51 (patch) | |
tree | be1a381102a73d97ec3cd071d138cc4338623d83 /spec | |
parent | 0d932b7e02b1d3618bf71012e20a33d7f2d282a6 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r-- | spec/migrations/20240116211138_update_max_code_indexing_concurrency_in_application_settings_for_gitlab_com_spec.rb | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/spec/migrations/20240116211138_update_max_code_indexing_concurrency_in_application_settings_for_gitlab_com_spec.rb b/spec/migrations/20240116211138_update_max_code_indexing_concurrency_in_application_settings_for_gitlab_com_spec.rb new file mode 100644 index 00000000000..8bed7e1b8a1 --- /dev/null +++ b/spec/migrations/20240116211138_update_max_code_indexing_concurrency_in_application_settings_for_gitlab_com_spec.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +require 'spec_helper' +require_migration! + +RSpec.describe UpdateMaxCodeIndexingConcurrencyInApplicationSettingsForGitlabCom, feature_category: :global_search do + let(:settings) { table(:application_settings) } + + describe "#up" do + subject(:up) { migrate! } + + it 'does nothing when not in gitlab.com' do + record = settings.create! + + expect { up }.not_to change { record.reload.elasticsearch_max_code_indexing_concurrency } + end + + it 'updates elasticsearch_worker_number_of_shards when gitlab.com' do + allow(Gitlab).to receive(:com?).and_return(true) + + record = settings.create! + + expect { up }.to change { record.reload.elasticsearch_max_code_indexing_concurrency }.from(30).to(60) + end + end + + describe "#down" do + subject(:down) { schema_migrate_down! } + + it 'does nothing when not in gitlab.com' do + record = settings.create!(elasticsearch_max_code_indexing_concurrency: 60) + + migrate! + + expect { down }.not_to change { record.reload.elasticsearch_max_code_indexing_concurrency } + end + + it 'updates elasticsearch_worker_number_of_shards when gitlab.com' do + allow(Gitlab).to receive(:com?).and_return(true) + + record = settings.create!(elasticsearch_max_code_indexing_concurrency: 60) + + migrate! + + expect { down }.to change { record.reload.elasticsearch_max_code_indexing_concurrency }.from(60).to(30) + end + end +end |