Commit fb719bf4 authored by Rémy Coutable's avatar Rémy Coutable

Allow to pass --tag to bin/qa run

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 01869e9b
...@@ -21,14 +21,18 @@ module QA ...@@ -21,14 +21,18 @@ module QA
def perform(address, *rspec_options) def perform(address, *rspec_options)
Runtime::Scenario.define(:gitlab_address, address) Runtime::Scenario.define(:gitlab_address, address)
##
# Perform before hooks, which are different for CE and EE
#
Runtime::Release.perform_before_hooks
Specs::Runner.perform do |specs| Specs::Runner.perform do |specs|
specs.tty = true specs.tty = true
specs.tags = self.class.focus
specs.options = specs.options =
if rspec_options.any? if rspec_options.any?
rspec_options rspec_options
else else
::File.expand_path('../specs/features', __dir__) ['--tag', self.class.focus.join(','), '--', ::File.expand_path('../specs/features', __dir__)]
end end
end end
end end
......
...@@ -20,13 +20,18 @@ module QA ...@@ -20,13 +20,18 @@ module QA
def self.do_perform(address, *rspec_options) def self.do_perform(address, *rspec_options)
Runtime::Scenario.define(:gitlab_address, address) Runtime::Scenario.define(:gitlab_address, address)
##
# Perform before hooks, which are different for CE and EE
#
Runtime::Release.perform_before_hooks
Specs::Runner.perform do |specs| Specs::Runner.perform do |specs|
specs.tty = true specs.tty = true
specs.options = specs.options =
if rspec_options.any? if rspec_options.any?
rspec_options rspec_options
else else
::File.expand_path('../specs/features', __dir__) ['--tag', self.class.focus.join(','), '--', ::File.expand_path('../../specs/features', __dir__)]
end end
end end
end end
......
...@@ -104,6 +104,8 @@ describe QA::Runtime::Env do ...@@ -104,6 +104,8 @@ describe QA::Runtime::Env do
describe '.github_access_token' do describe '.github_access_token' do
it 'returns "" if GITHUB_ACCESS_TOKEN is not defined' do it 'returns "" if GITHUB_ACCESS_TOKEN is not defined' do
stub_env('GITHUB_ACCESS_TOKEN', nil)
expect(described_class.github_access_token).to eq('') expect(described_class.github_access_token).to eq('')
end end
...@@ -115,6 +117,8 @@ describe QA::Runtime::Env do ...@@ -115,6 +117,8 @@ describe QA::Runtime::Env do
describe '.require_github_access_token!' do describe '.require_github_access_token!' do
it 'raises ArgumentError if GITHUB_ACCESS_TOKEN is not defined' do it 'raises ArgumentError if GITHUB_ACCESS_TOKEN is not defined' do
stub_env('GITHUB_ACCESS_TOKEN', nil)
expect { described_class.require_github_access_token! }.to raise_error(ArgumentError) expect { described_class.require_github_access_token! }.to raise_error(ArgumentError)
end end
......
describe QA::Scenario::Test::Instance::All do describe QA::Scenario::Test::Instance::All do
subject do
Class.new(described_class) do
tags :rspec, :foo
end
end
context '#perform' do context '#perform' do
let(:arguments) { spy('Runtime::Scenario') } let(:arguments) { spy('Runtime::Scenario') }
let(:release) { spy('Runtime::Release') } let(:release) { spy('Runtime::Release') }
...@@ -24,7 +30,7 @@ describe QA::Scenario::Test::Instance::All do ...@@ -24,7 +30,7 @@ describe QA::Scenario::Test::Instance::All do
subject.perform("test") subject.perform("test")
expect(runner).to have_received(:options=) expect(runner).to have_received(:options=)
.with(::File.expand_path('../../../../qa/specs/features', __dir__)) .with(['--tag', 'rspec,foo', '--', ::File.expand_path('../../../../qa/specs/features', __dir__)])
end end
end end
......
...@@ -30,7 +30,7 @@ describe QA::Scenario::Test::Instance::Smoke do ...@@ -30,7 +30,7 @@ describe QA::Scenario::Test::Instance::Smoke do
subject.perform("test") subject.perform("test")
expect(runner).to have_received(:options=) expect(runner).to have_received(:options=)
.with(::File.expand_path('../../../../qa/specs/features', __dir__)) .with(['--tag', 'smoke', '--', ::File.expand_path('../../../../qa/specs/features', __dir__)])
end end
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