Commit 8fc0c9db authored by Robert Speicher's avatar Robert Speicher

Merge branch 'ee-allow-to-quarantine-tests' into 'master'

[EE] Allow to quarantine tests

See merge request gitlab-org/gitlab-ee!9167
parents 5cabd7f6 bda8ea76
...@@ -620,6 +620,22 @@ rspec-mysql: ...@@ -620,6 +620,22 @@ rspec-mysql:
<<: *rspec-metadata-mysql <<: *rspec-metadata-mysql
parallel: 50 parallel: 50
.rspec-quarantine: &rspec-quarantine
script:
- export CACHE_CLASSES=true
- scripts/gitaly-test-spawn
- bin/rspec --color --format documentation --tag quarantine spec/
rspec-pg-quarantine:
<<: *rspec-metadata-pg
<<: *rspec-quarantine
allow_failure: true
rspec-mysql-quarantine:
<<: *rspec-metadata-mysql
<<: *rspec-quarantine
allow_failure: true
# EE jobs START # EE jobs START
rspec-pg-ee: rspec-pg-ee:
<<: *rspec-ee-pg <<: *rspec-ee-pg
...@@ -631,6 +647,23 @@ rspec-mysql-ee: ...@@ -631,6 +647,23 @@ rspec-mysql-ee:
rspec-pg geo: *rspec-metadata-pg-geo-9-6 rspec-pg geo: *rspec-metadata-pg-geo-9-6
rspec-pg-10 geo: *rspec-metadata-pg-geo-10-2 rspec-pg-10 geo: *rspec-metadata-pg-geo-10-2
.rspec-quarantine-ee: &rspec-quarantine-ee
script:
- export CACHE_CLASSES=true
- scripts/gitaly-test-spawn
- bin/rspec --color --format documentation --tag quarantine ee/spec/
rspec-pg-quarantine-ee:
<<: *rspec-metadata-pg
<<: *rspec-quarantine-ee
allow_failure: true
rspec-mysql-quarantine-ee:
<<: *rspec-metadata-mysql
<<: *rspec-quarantine-ee
allow_failure: true
# EE jobs END # EE jobs END
static-analysis: static-analysis:
......
...@@ -5,6 +5,18 @@ ...@@ -5,6 +5,18 @@
It's a test that sometimes fails, but if you retry it enough times, it passes, It's a test that sometimes fails, but if you retry it enough times, it passes,
eventually. eventually.
## Quarantined tests
Tests can be put in quarantine by assigning `:quarantine` metadata. This means
they will be skipped unless run with `--tag quarantine`. This can be used for
tests that are expected to fail while a fix is in progress (similar to how
[`skip` or `pending`](https://relishapp.com/rspec/rspec-core/v/3-8/docs/pending-and-skipped-examples)
can be used).
```
bin/rspec --tag quarantine
```
## Automatic retries and flaky tests detection ## Automatic retries and flaky tests detection
On our CI, we use [rspec-retry] to automatically retry a failing example a few On our CI, we use [rspec-retry] to automatically retry a failing example a few
......
...@@ -99,7 +99,7 @@ describe 'Issue Boards', :js do ...@@ -99,7 +99,7 @@ describe 'Issue Boards', :js do
expect(find('.board:nth-child(4)')).to have_selector('.board-card') expect(find('.board:nth-child(4)')).to have_selector('.board-card')
end end
it 'shows description tooltip on list title' do it 'shows description tooltip on list title', :quarantine do
page.within('.board:nth-child(2)') do page.within('.board:nth-child(2)') do
expect(find('.board-title span.has-tooltip')[:title]).to eq('Test') expect(find('.board-title span.has-tooltip')[:title]).to eq('Test')
end end
...@@ -413,7 +413,7 @@ describe 'Issue Boards', :js do ...@@ -413,7 +413,7 @@ describe 'Issue Boards', :js do
wait_for_empty_boards((2..4)) wait_for_empty_boards((2..4))
end end
it 'filters by label with space after reload' do it 'filters by label with space after reload', :quarantine do
set_filter("label", "\"#{accepting.title}") set_filter("label", "\"#{accepting.title}")
click_filter_link(accepting.title) click_filter_link(accepting.title)
submit_filter submit_filter
...@@ -479,7 +479,7 @@ describe 'Issue Boards', :js do ...@@ -479,7 +479,7 @@ describe 'Issue Boards', :js do
end end
end end
it 'filters by multiple labels' do it 'filters by multiple labels', :quarantine do
set_filter("label", testing.title) set_filter("label", testing.title)
click_filter_link(testing.title) click_filter_link(testing.title)
......
...@@ -22,7 +22,7 @@ if rspec_profiling_is_configured && (!ENV.key?('CI') || branch_can_be_profiled) ...@@ -22,7 +22,7 @@ if rspec_profiling_is_configured && (!ENV.key?('CI') || branch_can_be_profiled)
require 'rspec_profiling/rspec' require 'rspec_profiling/rspec'
end end
if ENV['CI'] && !ENV['NO_KNAPSACK'] if ENV['CI'] && ENV['KNAPSACK_GENERATE_REPORT'] && !ENV['NO_KNAPSACK']
require 'knapsack' require 'knapsack'
Knapsack::Adapters::RSpecAdapter.bind Knapsack::Adapters::RSpecAdapter.bind
end end
...@@ -134,6 +134,11 @@ RSpec.configure do |config| ...@@ -134,6 +134,11 @@ RSpec.configure do |config|
Gitlab::ReleaseBlogPost.instance.instance_variable_set(:@url, 'https://about.gitlab.com') Gitlab::ReleaseBlogPost.instance.instance_variable_set(:@url, 'https://about.gitlab.com')
end end
config.before(:example, :quarantine) do
# Skip tests in quarantine unless we explicitly focus on them.
skip('In quarantine') unless config.inclusion_filter[:quarantine]
end
config.before(:example, :request_store) do config.before(:example, :request_store) do
RequestStore.begin! RequestStore.begin!
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment