Allow to pass --tag to bin/qa run

Signed-off-by: Rémy Coutable <remy@rymai.me>
This commit is contained in:
Rémy Coutable 2018-08-03 13:25:14 +02:00
parent 02e9a8f947
commit 520fcaab1c
No known key found for this signature in database
GPG Key ID: 98DFFD1C0C62B70B
5 changed files with 24 additions and 5 deletions

View File

@ -21,14 +21,18 @@ module QA
def perform(address, *rspec_options)
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.tty = true
specs.tags = self.class.focus
specs.options =
if rspec_options.any?
rspec_options
else
::File.expand_path('../specs/features', __dir__)
['--tag', self.class.focus.join(','), '--', ::File.expand_path('../specs/features', __dir__)]
end
end
end

View File

@ -20,13 +20,18 @@ module QA
def self.do_perform(address, *rspec_options)
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.tty = true
specs.options =
if rspec_options.any?
rspec_options
else
::File.expand_path('../../specs/features', __dir__)
['--tag', self.class.focus.join(','), '--', ::File.expand_path('../../specs/features', __dir__)]
end
end
end

View File

@ -104,6 +104,8 @@ describe QA::Runtime::Env do
describe '.github_access_token' 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('')
end
@ -115,6 +117,8 @@ describe QA::Runtime::Env do
describe '.require_github_access_token!' 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)
end

View File

@ -1,4 +1,10 @@
describe QA::Scenario::Test::Instance::All do
subject do
Class.new(described_class) do
tags :rspec, :foo
end
end
context '#perform' do
let(:arguments) { spy('Runtime::Scenario') }
let(:release) { spy('Runtime::Release') }
@ -24,7 +30,7 @@ describe QA::Scenario::Test::Instance::All do
subject.perform("test")
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

View File

@ -30,7 +30,7 @@ describe QA::Scenario::Test::Instance::Smoke do
subject.perform("test")
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