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" RAILS_ENV: "test"
script: script:
- bundle exec rake zammad:db:init - 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 .template_rspec_db_reset: &template_rspec_db_reset
extends: extends:
@ -18,14 +18,25 @@ include:
RAILS_ENV: "test" RAILS_ENV: "test"
script: script:
- bundle exec rake zammad:db:init - 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 # RSpec 3rd party integration tests are independent of the database
# $IGNORE is not defined # therefore we need only one job and choose a random database for each run
ignore:
rspec:mysql:integration:
stage: test stage: test
only: extends:
variables: - .env_base
- $IGNORE - .services_mysql_postgresql
variables:
RAILS_ENV: "test"
rules:
- if: $CI_MERGE_REQUEST_ID
when: never
- if: '$CI_COMMIT_BRANCH =~ /^private/'
when: manual
allow_failure: true
- when: always
script: script:
- '' - bundle exec rake zammad:db:init
- bundle exec rspec -t type:integration

View file

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

View file

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