summaryrefslogtreecommitdiff
path: root/qa/qa/specs/helpers/quarantine.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-08-19 09:08:42 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-08-19 09:08:42 +0000
commitb76ae638462ab0f673e5915986070518dd3f9ad3 (patch)
treebdab0533383b52873be0ec0eb4d3c66598ff8b91 /qa/qa/specs/helpers/quarantine.rb
parent434373eabe7b4be9593d18a585fb763f1e5f1a6f (diff)
downloadgitlab-ce-b76ae638462ab0f673e5915986070518dd3f9ad3.tar.gz
Add latest changes from gitlab-org/gitlab@14-2-stable-eev14.2.0-rc42
Diffstat (limited to 'qa/qa/specs/helpers/quarantine.rb')
-rw-r--r--qa/qa/specs/helpers/quarantine.rb44
1 files changed, 12 insertions, 32 deletions
diff --git a/qa/qa/specs/helpers/quarantine.rb b/qa/qa/specs/helpers/quarantine.rb
index 15b4ed8336b..49d91fc87cd 100644
--- a/qa/qa/specs/helpers/quarantine.rb
+++ b/qa/qa/specs/helpers/quarantine.rb
@@ -10,26 +10,6 @@ module QA
extend self
- def configure_rspec
- ::RSpec.configure do |config|
- config.before(:context, :quarantine) do
- Quarantine.skip_or_run_quarantined_contexts(config.inclusion_filter.rules, self.class)
- end
-
- config.before do |example|
- Quarantine.skip_or_run_quarantined_tests_or_contexts(config.inclusion_filter.rules, example)
- end
- end
- end
-
- # Skip the entire context if a context is quarantined. This avoids running
- # before blocks unnecessarily.
- def skip_or_run_quarantined_contexts(filters, example)
- return unless example.metadata.key?(:quarantine)
-
- skip_or_run_quarantined_tests_or_contexts(filters, example)
- end
-
# Skip tests in quarantine unless we explicitly focus on them.
def skip_or_run_quarantined_tests_or_contexts(filters, example)
if filters.key?(:quarantine)
@@ -43,19 +23,19 @@ module QA
# running that ldap test as well because of the :quarantine metadata.
# We could use an exclusion filter, but this way the test report will list
# the quarantined tests when they're not run so that we're aware of them
- skip("Only running tests tagged with :quarantine and any of #{included_filters.keys}") if should_skip_when_focused?(example.metadata, included_filters)
- else
- if example.metadata.key?(:quarantine)
- quarantine_tag = example.metadata[:quarantine]
-
- if quarantine_tag.is_a?(Hash) && quarantine_tag&.key?(:only)
- # If the :quarantine hash contains :only, we respect that.
- # For instance `quarantine: { only: { subdomain: :staging } }` will only quarantine the test when it runs against staging.
- return unless ContextSelector.context_matches?(quarantine_tag[:only])
- end
+ if should_skip_when_focused?(example.metadata, included_filters)
+ example.metadata[:skip] = "Only running tests tagged with :quarantine and any of #{included_filters.keys}"
+ end
+ elsif example.metadata.key?(:quarantine)
+ quarantine_tag = example.metadata[:quarantine]
- skip(quarantine_message(quarantine_tag))
+ if quarantine_tag.is_a?(Hash) && quarantine_tag&.key?(:only) && !ContextSelector.context_matches?(quarantine_tag[:only])
+ # If the :quarantine hash contains :only, we respect that.
+ # For instance `quarantine: { only: { subdomain: :staging } }` will only quarantine the test when it runs against staging.
+ return
end
+
+ example.metadata[:skip] = quarantine_message(quarantine_tag)
end
end
@@ -64,7 +44,7 @@ module QA
end
def quarantine_message(quarantine_tag)
- quarantine_message = %w(In quarantine)
+ quarantine_message = %w[In quarantine]
quarantine_message << case quarantine_tag
when String
": #{quarantine_tag}"