Commit 75b1837d authored by Robert Speicher's avatar Robert Speicher

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

Allow to quarantine tests

See merge request gitlab-org/gitlab-ce!24369
parents 3499da77 d71eb8fc
...@@ -499,6 +499,22 @@ rspec-mysql: ...@@ -499,6 +499,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
static-analysis: static-analysis:
<<: *dedicated-no-docs-no-db-pull-cache-job <<: *dedicated-no-docs-no-db-pull-cache-job
dependencies: dependencies:
......
...@@ -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
......
...@@ -97,7 +97,7 @@ describe 'Issue Boards', :js do ...@@ -97,7 +97,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
...@@ -411,7 +411,7 @@ describe 'Issue Boards', :js do ...@@ -411,7 +411,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
...@@ -477,7 +477,7 @@ describe 'Issue Boards', :js do ...@@ -477,7 +477,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
...@@ -132,6 +132,11 @@ RSpec.configure do |config| ...@@ -132,6 +132,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