Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/qa/spec
diff options
context:
space:
mode:
authorMark Lapierre <mlapierre@gitlab.com>2019-01-08 18:33:45 +0300
committerMark Lapierre <mlapierre@gitlab.com>2019-01-08 19:07:58 +0300
commitf1b36aa46c68eba573f8e25bad91a0d9e1bf24da (patch)
tree3974726bc5a76e264059960120db4534d483d920 /qa/spec
parentf802d49656ccc326a2bbf033eea6f9714339d249 (diff)
Quarantine spec code review changes
- Clarify message shown when skipping quarantined tests because they don't have all the specified tags. - Simplify rejecting item from array - Remove 'pass' from example descriptions to avoid confusion
Diffstat (limited to 'qa/spec')
-rw-r--r--qa/spec/spec_helper.rb5
-rw-r--r--qa/spec/spec_helper_spec.rb34
2 files changed, 19 insertions, 20 deletions
diff --git a/qa/spec/spec_helper.rb b/qa/spec/spec_helper.rb
index 53a3aa4c727..3537ba7c235 100644
--- a/qa/spec/spec_helper.rb
+++ b/qa/spec/spec_helper.rb
@@ -14,7 +14,7 @@ RSpec.configure do |config|
# using `--tag quarantine --tag smoke`, without this check we'd end up
# running that ldap test as well.
if config.inclusion_filter[:quarantine]
- skip('Running only tagged tests in quarantine') unless quarantine_and_optional_other_tag?(example, config)
+ skip("Running tests tagged with all of #{config.inclusion_filter.rules.keys}") unless quarantine_and_optional_other_tag?(example, config)
end
end
@@ -50,8 +50,7 @@ end
def quarantine_and_optional_other_tag?(example, config)
return false unless example.metadata.keys.include? :quarantine
- filters_other_than_quarantine = config.inclusion_filter.rules.keys.dup
- filters_other_than_quarantine.delete :quarantine
+ filters_other_than_quarantine = config.inclusion_filter.rules.keys.reject { |key| key == :quarantine }
return true if filters_other_than_quarantine.empty?
diff --git a/qa/spec/spec_helper_spec.rb b/qa/spec/spec_helper_spec.rb
index 5a6a142f021..f001200fb52 100644
--- a/qa/spec/spec_helper_spec.rb
+++ b/qa/spec/spec_helper_spec.rb
@@ -4,9 +4,9 @@ describe 'rspec config tests' do
let(:group) do
RSpec.describe do
shared_examples 'passing tests' do
- example 'pass: not in quarantine' do
+ example 'not in quarantine' do
end
- example 'pass: in quarantine', :quarantine do
+ example 'in quarantine', :quarantine do
end
end
@@ -28,10 +28,10 @@ describe 'rspec config tests' do
foo_examples = foo_context.descendant_filtered_examples
expect(foo_examples.count).to eq(2)
- ex = foo_examples.find { |e| e.description == "pass: not in quarantine" }
+ ex = foo_examples.find { |e| e.description == "not in quarantine" }
expect(ex.execution_result.status).to eq(:passed)
- ex = foo_examples.find { |e| e.description == "pass: in quarantine" }
+ ex = foo_examples.find { |e| e.description == "in quarantine" }
expect(ex.execution_result.status).to eq(:pending)
expect(ex.execution_result.pending_message).to eq('In quarantine')
@@ -39,10 +39,10 @@ describe 'rspec config tests' do
default_examples = default_context.descendant_filtered_examples
expect(default_examples.count).to eq(2)
- ex = default_examples.find { |e| e.description == "pass: not in quarantine" }
+ ex = default_examples.find { |e| e.description == "not in quarantine" }
expect(ex.execution_result.status).to eq(:passed)
- ex = default_examples.find { |e| e.description == "pass: in quarantine" }
+ ex = default_examples.find { |e| e.description == "in quarantine" }
expect(ex.execution_result.status).to eq(:pending)
expect(ex.execution_result.pending_message).to eq('In quarantine')
end
@@ -67,14 +67,14 @@ describe 'rspec config tests' do
foo_examples = foo_context.descendant_filtered_examples
expect(foo_examples.count).to be(1)
- ex = foo_examples.find { |e| e.description == "pass: in quarantine" }
+ ex = foo_examples.find { |e| e.description == "in quarantine" }
expect(ex.execution_result.status).to eq(:passed)
default_context = group.children.find { |c| c.description == "default" }
default_examples = default_context.descendant_filtered_examples
expect(default_examples.count).to be(1)
- ex = default_examples.find { |e| e.description == "pass: in quarantine" }
+ ex = default_examples.find { |e| e.description == "in quarantine" }
expect(ex.execution_result.status).to eq(:passed)
end
end
@@ -103,10 +103,10 @@ describe 'rspec config tests' do
foo_examples = foo_context.descendant_filtered_examples
expect(foo_examples.count).to eq(2)
- ex = foo_examples.find { |e| e.description == "pass: not in quarantine" }
+ ex = foo_examples.find { |e| e.description == "not in quarantine" }
expect(ex.execution_result.status).to eq(:passed)
- ex = foo_examples.find { |e| e.description == "pass: in quarantine" }
+ ex = foo_examples.find { |e| e.description == "in quarantine" }
expect(ex.execution_result.status).to eq(:pending)
expect(ex.execution_result.pending_message).to eq('In quarantine')
end
@@ -131,11 +131,11 @@ describe 'rspec config tests' do
foo_examples = foo_context.descendant_filtered_examples
expect(foo_examples.count).to eq(2)
- ex = foo_examples.find { |e| e.description == "pass: not in quarantine" }
+ ex = foo_examples.find { |e| e.description == "not in quarantine" }
expect(ex.execution_result.status).to eq(:pending)
- expect(ex.execution_result.pending_message).to eq('Running only tagged tests in quarantine')
+ expect(ex.execution_result.pending_message).to eq('Running tests tagged with all of [:quarantine, :foo]')
- ex = foo_examples.find { |e| e.description == "pass: in quarantine" }
+ ex = foo_examples.find { |e| e.description == "in quarantine" }
expect(ex.execution_result.status).to eq(:passed)
end
@@ -145,9 +145,9 @@ describe 'rspec config tests' do
default_examples = default_context.descendant_filtered_examples
expect(default_examples.count).to eq(1)
- ex = default_examples.find { |e| e.description == "pass: in quarantine" }
+ ex = default_examples.find { |e| e.description == "in quarantine" }
expect(ex.execution_result.status).to eq(:pending)
- expect(ex.execution_result.pending_message).to eq('Running only tagged tests in quarantine')
+ expect(ex.execution_result.pending_message).to eq('Running tests tagged with all of [:quarantine, :foo]')
end
end
@@ -248,14 +248,14 @@ describe 'rspec config tests' do
ex = group.examples.find { |e| e.description == "foo" }
expect(ex.execution_result.status).to eq(:pending)
- expect(ex.execution_result.pending_message).to eq('Running only tagged tests in quarantine')
+ expect(ex.execution_result.pending_message).to eq('Running tests tagged with all of [:bar, :foo, :quarantine]')
ex = group.examples.find { |e| e.description == "bar and quarantine" }
expect(ex.execution_result.status).to eq(:passed)
ex = group.examples.find { |e| e.description == "foo and bar" }
expect(ex.execution_result.status).to eq(:pending)
- expect(ex.execution_result.pending_message).to eq('Running only tagged tests in quarantine')
+ expect(ex.execution_result.pending_message).to eq('Running tests tagged with all of [:bar, :foo, :quarantine]')
ex = group.examples.find { |e| e.description == "foo, bar, and quarantine" }
expect(ex.execution_result.status).to eq(:passed)