diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-05 06:12:41 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-05 06:12:41 +0000 |
commit | 7c0c3a7dc95668d20ec8f4bbc2d505f373b6032a (patch) | |
tree | 2034e645e8aada36db5d816d271d7f2d8728157d /spec/config | |
parent | d8abaef3c6859400b684427ba57aa247b6272cb1 (diff) | |
download | gitlab-ce-7c0c3a7dc95668d20ec8f4bbc2d505f373b6032a.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/config')
-rw-r--r-- | spec/config/mail_room_spec.rb | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/spec/config/mail_room_spec.rb b/spec/config/mail_room_spec.rb index a3806fb3cb6..ace8bf5aa24 100644 --- a/spec/config/mail_room_spec.rb +++ b/spec/config/mail_room_spec.rb @@ -7,12 +7,13 @@ RSpec.describe 'mail_room.yml', feature_category: :service_desk do let(:mailroom_config_path) { 'config/mail_room.yml' } let(:gitlab_config_path) { 'config/mail_room.yml' } + let(:queues_config_source_path) { 'config/redis.queues.yml' } let(:queues_config_path) { 'config/redis.queues.yml' } + let(:queue_config_tmp_path) { 'config/redis.queues.yml.tmp' } let(:configuration) do vars = { - 'MAIL_ROOM_GITLAB_CONFIG_FILE' => absolute_path(gitlab_config_path), - 'GITLAB_REDIS_QUEUES_CONFIG_FILE' => absolute_path(queues_config_path) + 'MAIL_ROOM_GITLAB_CONFIG_FILE' => absolute_path(gitlab_config_path) } cmd = "puts ERB.new(File.read(#{absolute_path(mailroom_config_path).inspect})).result" @@ -25,8 +26,16 @@ RSpec.describe 'mail_room.yml', feature_category: :service_desk do YAML.safe_load(output, permitted_classes: [Symbol]) end - before do - stub_env('GITLAB_REDIS_QUEUES_CONFIG_FILE', absolute_path(queues_config_path)) + around do |example| + # put aside config/redis.queues.yml if it exists + FileUtils.mv(queues_config_path, queue_config_tmp_path) if File.file?(queues_config_path) + + # set config/redis.queues.yml + FileUtils.cp(queues_config_source_path, queues_config_path) if queues_config_source_path != queues_config_path + + example.run + + FileUtils.mv(queue_config_tmp_path, queues_config_path) if File.file?(queue_config_tmp_path) end context 'when incoming email is disabled' do @@ -39,7 +48,7 @@ RSpec.describe 'mail_room.yml', feature_category: :service_desk do context 'when both incoming email and service desk email are enabled' do let(:gitlab_config_path) { 'spec/fixtures/config/mail_room_enabled.yml' } - let(:queues_config_path) { 'spec/fixtures/config/redis_new_format_host.yml' } + let(:queues_config_source_path) { 'spec/fixtures/config/redis_new_format_host.yml' } let(:gitlab_redis_queues) { Gitlab::Redis::Queues.new(Rails.env) } it 'contains the intended configuration' do @@ -69,7 +78,7 @@ RSpec.describe 'mail_room.yml', feature_category: :service_desk do context 'when both incoming email and service desk email are enabled for Microsoft Graph' do let(:gitlab_config_path) { 'spec/fixtures/config/mail_room_enabled_ms_graph.yml' } - let(:queues_config_path) { 'spec/fixtures/config/redis_new_format_host.yml' } + let(:queues_config_source_path) { 'spec/fixtures/config/redis_new_format_host.yml' } let(:gitlab_redis_queues) { Gitlab::Redis::Queues.new(Rails.env) } it 'contains the intended configuration' do |