diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-21 02:50:22 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-21 02:50:22 +0300 |
commit | 9dc93a4519d9d5d7be48ff274127136236a3adb3 (patch) | |
tree | 70467ae3692a0e35e5ea56bcb803eb512a10bedb /spec/config/mail_room_spec.rb | |
parent | 4b0f34b6d759d6299322b3a54453e930c6121ff0 (diff) |
Add latest changes from gitlab-org/gitlab@13-11-stable-eev13.11.0-rc43
Diffstat (limited to 'spec/config/mail_room_spec.rb')
-rw-r--r-- | spec/config/mail_room_spec.rb | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/spec/config/mail_room_spec.rb b/spec/config/mail_room_spec.rb index 289e18be0d7..6265b54931a 100644 --- a/spec/config/mail_room_spec.rb +++ b/spec/config/mail_room_spec.rb @@ -16,7 +16,9 @@ RSpec.describe 'mail_room.yml' do } cmd = "puts ERB.new(File.read(#{absolute_path(mailroom_config_path).inspect})).result" - output, status = Gitlab::Popen.popen(%W(ruby -rerb -e #{cmd}), absolute_path('config'), vars) + result = Gitlab::Popen.popen_with_detail(%W(ruby -rerb -e #{cmd}), absolute_path('config'), vars) + output = result.stdout + status = result.status raise "Error interpreting #{mailroom_config_path}: #{output}" unless status == 0 YAML.load(output) @@ -68,6 +70,39 @@ RSpec.describe 'mail_room.yml' do end end + 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_queues_new_format_host.yml' } + let(:gitlab_redis_queues) { Gitlab::Redis::Queues.new(Rails.env) } + + it 'contains the intended configuration' do + expected_mailbox = { + email: 'gitlab-incoming@gmail.com', + name: 'inbox', + idle_timeout: 60, + expunge_deleted: true + } + expected_options = { + redis_url: gitlab_redis_queues.url, + sentinels: gitlab_redis_queues.sentinels + } + expected_inbox_options = { + tenant_id: '12345', + client_id: 'MY-CLIENT-ID', + client_secret: 'MY-CLIENT-SECRET', + poll_interval: 60 + } + + expect(configuration[:mailboxes].length).to eq(2) + expect(configuration[:mailboxes]).to all(include(expected_mailbox)) + expect(configuration[:mailboxes].map { |m| m[:inbox_method] }).to all(eq('microsoft_graph')) + expect(configuration[:mailboxes].map { |m| m[:inbox_options] }).to all(eq(expected_inbox_options)) + expect(configuration[:mailboxes].map { |m| m[:delivery_options] }).to all(include(expected_options)) + expect(configuration[:mailboxes].map { |m| m[:delivery_options] }).to all(include(expected_options)) + expect(configuration[:mailboxes].map { |m| m[:arbitration_options] }).to all(include(expected_options)) + end + end + def clear_queues_raw_config Gitlab::Redis::Queues.remove_instance_variable(:@_raw_config) rescue NameError |