Maintenance: Run XOAUTH2 Gmail and Microsoft365 integration tests in dedicated job and only for develop/stable because of extreme throtteling and fail rate of the providers.

This commit is contained in:
Thorsten Eckel 2020-11-23 14:13:16 +01:00
parent e474539f55
commit 21d02f7b6e
3 changed files with 26 additions and 15 deletions

View file

@ -9,7 +9,7 @@ include:
RAILS_ENV: "test"
script:
- bundle exec rake zammad:db:init
- bundle exec rspec -t ~type:system -t ~searchindex -t ~db_strategy:reset
- bundle exec rspec --exclude-pattern "spec/{system,integration}/**/*_spec.rb" -t ~searchindex -t ~db_strategy:reset
.template_rspec_db_reset: &template_rspec_db_reset
extends:
@ -18,14 +18,25 @@ include:
RAILS_ENV: "test"
script:
- bundle exec rake zammad:db:init
- bundle exec rspec -t ~type:system -t ~searchindex -t db_strategy:reset
- bundle exec rspec --exclude-pattern "spec/{system,integration}/**/*_spec.rb" -t ~searchindex -t db_strategy:reset
# we need at least one job to store and include this template
# $IGNORE is not defined
ignore:
# RSpec 3rd party integration tests are independent of the database
# therefore we need only one job and choose a random database for each run
rspec:mysql:integration:
stage: test
only:
extends:
- .env_base
- .services_mysql_postgresql
variables:
- $IGNORE
RAILS_ENV: "test"
rules:
- if: $CI_MERGE_REQUEST_ID
when: never
- if: '$CI_COMMIT_BRANCH =~ /^private/'
when: manual
allow_failure: true
- when: always
script:
- ''
- bundle exec rake zammad:db:init
- bundle exec rspec -t type:integration

View file

@ -1,5 +1,5 @@
require 'rails_helper'
RSpec.describe 'Gmail XOAUTH2' do # rubocop:disable RSpec/DescribeClass
RSpec.describe 'Gmail XOAUTH2', type: :integration do # rubocop:disable RSpec/DescribeClass
let(:channel) do
create(:google_channel).tap(&:refresh_xoauth2!)
end
@ -11,14 +11,14 @@ RSpec.describe 'Gmail XOAUTH2' do # rubocop:disable RSpec/DescribeClass
end
end
context 'inbound' do
context 'when probing inbound' do
it 'succeeds' do
result = EmailHelper::Probe.inbound(channel.options[:inbound])
expect(result[:result]).to eq('ok')
end
end
context 'outbound' do
context 'when probing outbound' do
it 'succeeds' do
result = EmailHelper::Probe.outbound(channel.options[:outbound], ENV['GMAIL_USER'], "test gmail oauth unittest #{Random.new_seed}")
expect(result[:result]).to eq('ok')

View file

@ -1,5 +1,5 @@
require 'rails_helper'
RSpec.describe 'Microsoft365 XOAUTH2' do # rubocop:disable RSpec/DescribeClass
RSpec.describe 'Microsoft365 XOAUTH2', type: :integration do # rubocop:disable RSpec/DescribeClass
let(:channel) do
create(:microsoft365_channel).tap(&:refresh_xoauth2!)
end
@ -11,14 +11,14 @@ RSpec.describe 'Microsoft365 XOAUTH2' do # rubocop:disable RSpec/DescribeClass
end
end
context 'inbound' do
context 'when probing inbound' do
it 'succeeds' do
result = EmailHelper::Probe.inbound(channel.options[:inbound])
expect(result[:result]).to eq('ok')
end
end
context 'outbound' do
context 'when probing outbound' do
it 'succeeds' do
result = EmailHelper::Probe.outbound(channel.options[:outbound], ENV['MICROSOFT365_USER'], "test microsoft365 oauth unittest #{Random.new_seed}")
expect(result[:result]).to eq('ok')