diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-17 19:05:49 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-17 19:05:49 +0300 |
commit | 43a25d93ebdabea52f99b05e15b06250cd8f07d7 (patch) | |
tree | dceebdc68925362117480a5d672bcff122fb625b /spec/config | |
parent | 20c84b99005abd1c82101dfeff264ac50d2df211 (diff) |
Add latest changes from gitlab-org/gitlab@16-0-stable-eev16.0.0-rc42
Diffstat (limited to 'spec/config')
-rw-r--r-- | spec/config/inject_enterprise_edition_module_spec.rb | 2 | ||||
-rw-r--r-- | spec/config/mail_room_spec.rb | 21 | ||||
-rw-r--r-- | spec/config/object_store_settings_spec.rb | 18 | ||||
-rw-r--r-- | spec/config/settings_spec.rb | 18 | ||||
-rw-r--r-- | spec/config/smime_signature_settings_spec.rb | 8 |
5 files changed, 35 insertions, 32 deletions
diff --git a/spec/config/inject_enterprise_edition_module_spec.rb b/spec/config/inject_enterprise_edition_module_spec.rb index e8c0905ff89..6689fed02f5 100644 --- a/spec/config/inject_enterprise_edition_module_spec.rb +++ b/spec/config/inject_enterprise_edition_module_spec.rb @@ -2,7 +2,7 @@ require 'fast_spec_helper' -RSpec.describe InjectEnterpriseEditionModule, feature_category: :not_owned do +RSpec.describe InjectEnterpriseEditionModule, feature_category: :shared do let(:extension_name) { 'FF' } let(:extension_namespace) { Module.new } let(:fish_name) { 'Fish' } diff --git a/spec/config/mail_room_spec.rb b/spec/config/mail_room_spec.rb index a3806fb3cb6..05230b65956 100644 --- a/spec/config/mail_room_spec.rb +++ b/spec/config/mail_room_spec.rb @@ -9,24 +9,13 @@ RSpec.describe 'mail_room.yml', feature_category: :service_desk do let(:gitlab_config_path) { 'config/mail_room.yml' } let(:queues_config_path) { 'config/redis.queues.yml' } - let(:configuration) do - vars = { - 'MAIL_ROOM_GITLAB_CONFIG_FILE' => absolute_path(gitlab_config_path), - 'GITLAB_REDIS_QUEUES_CONFIG_FILE' => absolute_path(queues_config_path) - } - cmd = "puts ERB.new(File.read(#{absolute_path(mailroom_config_path).inspect})).result" - - result = Gitlab::Popen.popen_with_detail(%W(ruby -rerb -e #{cmd}), absolute_path('config'), vars) - output = result.stdout - errors = result.stderr - status = result.status - raise "Error interpreting #{mailroom_config_path}: #{output}\n#{errors}" unless status == 0 - - YAML.safe_load(output, permitted_classes: [Symbol]) - end + let(:configuration) { YAML.safe_load(ERB.new(File.read(mailroom_config_path)).result, permitted_classes: [Symbol]) } before do - stub_env('GITLAB_REDIS_QUEUES_CONFIG_FILE', absolute_path(queues_config_path)) + stub_env('MAIL_ROOM_GITLAB_CONFIG_FILE', absolute_path(gitlab_config_path)) + allow(Gitlab::Redis::Queues).to receive(:config_file_name).and_return(queues_config_path) + Gitlab::MailRoom.instance_variable_set(:@enabled_configs, nil) + Gitlab::MailRoom.instance_variable_set(:@yaml, nil) end context 'when incoming email is disabled' do diff --git a/spec/config/object_store_settings_spec.rb b/spec/config/object_store_settings_spec.rb index 7b4fa495288..b8e46affc2a 100644 --- a/spec/config/object_store_settings_spec.rb +++ b/spec/config/object_store_settings_spec.rb @@ -3,9 +3,9 @@ require 'spec_helper' require Rails.root.join('config', 'object_store_settings.rb') -RSpec.describe ObjectStoreSettings, feature_category: :not_owned do +RSpec.describe ObjectStoreSettings, feature_category: :shared do describe '#parse!' do - let(:settings) { Settingslogic.new(config) } + let(:settings) { GitlabSettings::Options.build(config) } subject { described_class.new(settings).parse! } @@ -68,7 +68,7 @@ RSpec.describe ObjectStoreSettings, feature_category: :not_owned do expect(settings.artifacts['enabled']).to be true expect(settings.artifacts['object_store']['enabled']).to be true - expect(settings.artifacts['object_store']['connection']).to eq(connection) + expect(settings.artifacts['object_store']['connection'].to_hash).to eq(connection) expect(settings.artifacts['object_store']['direct_upload']).to be true expect(settings.artifacts['object_store']['proxy_download']).to be false expect(settings.artifacts['object_store']['remote_directory']).to eq('artifacts') @@ -78,7 +78,7 @@ RSpec.describe ObjectStoreSettings, feature_category: :not_owned do expect(settings.lfs['enabled']).to be true expect(settings.lfs['object_store']['enabled']).to be true - expect(settings.lfs['object_store']['connection']).to eq(connection) + expect(settings.lfs['object_store']['connection'].to_hash).to eq(connection) expect(settings.lfs['object_store']['direct_upload']).to be true expect(settings.lfs['object_store']['proxy_download']).to be true expect(settings.lfs['object_store']['remote_directory']).to eq('lfs-objects') @@ -88,7 +88,7 @@ RSpec.describe ObjectStoreSettings, feature_category: :not_owned do expect(settings.pages['enabled']).to be true expect(settings.pages['object_store']['enabled']).to be true - expect(settings.pages['object_store']['connection']).to eq(connection) + expect(settings.pages['object_store']['connection'].to_hash).to eq(connection) expect(settings.pages['object_store']['remote_directory']).to eq('pages') expect(settings.pages['object_store']['bucket_prefix']).to eq(nil) expect(settings.pages['object_store']['consolidated_settings']).to be true @@ -128,7 +128,7 @@ RSpec.describe ObjectStoreSettings, feature_category: :not_owned do it 'populates artifacts CDN config' do subject - expect(settings.artifacts['object_store']['cdn']).to eq(cdn_config) + expect(settings.artifacts['object_store']['cdn'].to_hash).to eq(cdn_config) end end @@ -163,7 +163,7 @@ RSpec.describe ObjectStoreSettings, feature_category: :not_owned do it 'allows pages to define its own connection' do expect { subject }.not_to raise_error - expect(settings.pages['object_store']['connection']).to eq(pages_connection) + expect(settings.pages['object_store']['connection'].to_hash).to eq(pages_connection) expect(settings.pages['object_store']['consolidated_settings']).to be_falsey end end @@ -230,7 +230,7 @@ RSpec.describe ObjectStoreSettings, feature_category: :not_owned do end it 'respects original values' do - original_settings = Settingslogic.new({ + original_settings = GitlabSettings::Options.build({ 'enabled' => true, 'remote_directory' => 'artifacts' }) @@ -244,7 +244,7 @@ RSpec.describe ObjectStoreSettings, feature_category: :not_owned do end it 'supports bucket prefixes' do - original_settings = Settingslogic.new({ + original_settings = GitlabSettings::Options.build({ 'enabled' => true, 'remote_directory' => 'gitlab/artifacts' }) diff --git a/spec/config/settings_spec.rb b/spec/config/settings_spec.rb index 0928f2b72ff..55e675d5107 100644 --- a/spec/config/settings_spec.rb +++ b/spec/config/settings_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Settings, feature_category: :authentication_and_authorization do +RSpec.describe Settings, feature_category: :system_access do using RSpec::Parameterized::TableSyntax describe 'omniauth' do @@ -31,7 +31,7 @@ RSpec.describe Settings, feature_category: :authentication_and_authorization do with_them do before do allow(Gitlab.config).to receive(:gitlab).and_return( - Settingslogic.new({ + GitlabSettings::Options.build({ 'host' => host, 'https' => true, 'port' => port, @@ -198,4 +198,18 @@ RSpec.describe Settings, feature_category: :authentication_and_authorization do end end end + + describe '.build_sidekiq_routing_rules' do + using RSpec::Parameterized::TableSyntax + + where(:input_rules, :result) do + nil | [['*', 'default']] + [] | [['*', 'default']] + [['name=foobar', 'foobar']] | [['name=foobar', 'foobar']] + end + + with_them do + it { expect(described_class.send(:build_sidekiq_routing_rules, input_rules)).to eq(result) } + end + end end diff --git a/spec/config/smime_signature_settings_spec.rb b/spec/config/smime_signature_settings_spec.rb index 477ad4a74ed..53e70f1f2cc 100644 --- a/spec/config/smime_signature_settings_spec.rb +++ b/spec/config/smime_signature_settings_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe SmimeSignatureSettings, feature_category: :not_owned do +RSpec.describe SmimeSignatureSettings, feature_category: :shared do describe '.parse' do let(:default_smime_key) { Rails.root.join('.gitlab_smime_key') } let(:default_smime_cert) { Rails.root.join('.gitlab_smime_cert') } @@ -19,7 +19,7 @@ RSpec.describe SmimeSignatureSettings, feature_category: :not_owned do context 'when providing custom values' do it 'sets correct default values to disabled' do - custom_settings = Settingslogic.new({}) + custom_settings = GitlabSettings::Options.build({}) parsed_settings = described_class.parse(custom_settings) @@ -30,7 +30,7 @@ RSpec.describe SmimeSignatureSettings, feature_category: :not_owned do end it 'enables smime with default key and cert' do - custom_settings = Settingslogic.new({ + custom_settings = GitlabSettings::Options.build({ 'enabled' => true }) @@ -46,7 +46,7 @@ RSpec.describe SmimeSignatureSettings, feature_category: :not_owned do custom_key = '/custom/key' custom_cert = '/custom/cert' custom_ca_certs = '/custom/ca_certs' - custom_settings = Settingslogic.new({ + custom_settings = GitlabSettings::Options.build({ 'enabled' => true, 'key_file' => custom_key, 'cert_file' => custom_cert, |