diff options
author | Rémy Coutable <remy@rymai.me> | 2018-09-03 13:08:49 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2018-09-04 20:34:12 +0300 |
commit | 144b017d77c341849d37927b765c75888569d530 (patch) | |
tree | 358d02e9b748f683ca7fd4c3e0aed37ea19dd6a3 /qa/spec/scenario | |
parent | 3e1466d99d7ef34c0b42a07e6db3329896374b41 (diff) |
[QA] Fix Specs::Runner that would always excluding the orchectsrated tag
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'qa/spec/scenario')
-rw-r--r-- | qa/spec/scenario/test/instance/all_spec.rb | 44 | ||||
-rw-r--r-- | qa/spec/scenario/test/instance/smoke_spec.rb | 44 | ||||
-rw-r--r-- | qa/spec/scenario/test/integration/github_spec.rb | 21 | ||||
-rw-r--r-- | qa/spec/scenario/test/integration/kubernetes_spec.rb | 9 | ||||
-rw-r--r-- | qa/spec/scenario/test/integration/ldap_spec.rb | 9 | ||||
-rw-r--r-- | qa/spec/scenario/test/integration/mattermost_spec.rb | 18 | ||||
-rw-r--r-- | qa/spec/scenario/test/integration/object_storage_spec.rb | 9 |
7 files changed, 69 insertions, 85 deletions
diff --git a/qa/spec/scenario/test/instance/all_spec.rb b/qa/spec/scenario/test/instance/all_spec.rb index 1d96352550b..9311d1d8199 100644 --- a/qa/spec/scenario/test/instance/all_spec.rb +++ b/qa/spec/scenario/test/instance/all_spec.rb @@ -1,45 +1,3 @@ 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') } - let(:runner) { spy('Specs::Runner') } - - before do - stub_const('QA::Runtime::Release', release) - stub_const('QA::Runtime::Scenario', arguments) - stub_const('QA::Specs::Runner', runner) - - allow(runner).to receive(:perform).and_yield(runner) - end - - it 'sets an address of the subject' do - subject.perform("hello") - - expect(arguments).to have_received(:define) - .with(:gitlab_address, "hello") - end - - context 'no paths' do - it 'calls runner with default arguments' do - subject.perform("test") - - expect(runner).to have_received(:options=) - .with(['--tag', 'rspec,foo', '--', ::File.expand_path('../../../../qa/specs/features', __dir__)]) - end - end - - context 'specifying paths' do - it 'calls runner with paths' do - subject.perform('test', 'path1', 'path2') - - expect(runner).to have_received(:options=).with(%w[path1 path2]) - end - end - end + it_behaves_like 'a QA scenario class' end diff --git a/qa/spec/scenario/test/instance/smoke_spec.rb b/qa/spec/scenario/test/instance/smoke_spec.rb index 386eefae930..b5db9783af3 100644 --- a/qa/spec/scenario/test/instance/smoke_spec.rb +++ b/qa/spec/scenario/test/instance/smoke_spec.rb @@ -1,45 +1,5 @@ describe QA::Scenario::Test::Instance::Smoke do - subject { Class.new(described_class) { tags :smoke } } - - context '#perform' do - let(:arguments) { spy('Runtime::Scenario') } - let(:release) { spy('Runtime::Release') } - let(:runner) { spy('Specs::Runner') } - - before do - stub_const('QA::Runtime::Release', release) - stub_const('QA::Runtime::Scenario', arguments) - stub_const('QA::Specs::Runner', runner) - - allow(runner).to receive(:perform).and_yield(runner) - end - - it 'sets an address of the subject' do - subject.perform("hello") - - expect(arguments).to have_received(:define) - .with(:gitlab_address, "hello") - end - - it 'has a smoke tag' do - expect(subject.focus).to eq([:smoke]) # rubocop:disable Focus - end - - context 'no paths' do - it 'calls runner with default arguments' do - subject.perform("test") - - expect(runner).to have_received(:options=) - .with(['--tag', 'smoke', '--', ::File.expand_path('../../../../qa/specs/features', __dir__)]) - end - end - - context 'specifying paths' do - it 'calls runner with paths' do - subject.perform('test', 'path1', 'path2') - - expect(runner).to have_received(:options=).with(%w[path1 path2]) - end - end + it_behaves_like 'a QA scenario class' do + let(:tags) { [:smoke] } end end diff --git a/qa/spec/scenario/test/integration/github_spec.rb b/qa/spec/scenario/test/integration/github_spec.rb new file mode 100644 index 00000000000..c2aeb1ded1d --- /dev/null +++ b/qa/spec/scenario/test/integration/github_spec.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +describe QA::Scenario::Test::Integration::Github do + context '#perform' do + let(:env) { spy('Runtime::Env') } + + before do + stub_const('QA::Runtime::Env', env) + end + + it_behaves_like 'a QA scenario class' do + let(:tags) { [:github] } + + it 'requires a GitHub access token' do + subject.perform('gitlab_address') + + expect(env).to have_received(:require_github_access_token!) + end + end + end +end diff --git a/qa/spec/scenario/test/integration/kubernetes_spec.rb b/qa/spec/scenario/test/integration/kubernetes_spec.rb new file mode 100644 index 00000000000..cb43994b229 --- /dev/null +++ b/qa/spec/scenario/test/integration/kubernetes_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +describe QA::Scenario::Test::Integration::Kubernetes do + context '#perform' do + it_behaves_like 'a QA scenario class' do + let(:tags) { [:kubernetes] } + end + end +end diff --git a/qa/spec/scenario/test/integration/ldap_spec.rb b/qa/spec/scenario/test/integration/ldap_spec.rb new file mode 100644 index 00000000000..198856aec3f --- /dev/null +++ b/qa/spec/scenario/test/integration/ldap_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +describe QA::Scenario::Test::Integration::LDAP do + context '#perform' do + it_behaves_like 'a QA scenario class' do + let(:tags) { [:ldap] } + end + end +end diff --git a/qa/spec/scenario/test/integration/mattermost_spec.rb b/qa/spec/scenario/test/integration/mattermost_spec.rb new file mode 100644 index 00000000000..59caf2ba2cd --- /dev/null +++ b/qa/spec/scenario/test/integration/mattermost_spec.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +describe QA::Scenario::Test::Integration::Mattermost do + context '#perform' do + it_behaves_like 'a QA scenario class' do + let(:args) { %w[gitlab_address mattermost_address] } + let(:tags) { [:mattermost] } + let(:options) { ['path1']} + + it 'requires a GitHub access token' do + subject.perform(*args) + + expect(attributes).to have_received(:define) + .with(:mattermost_address, 'mattermost_address') + end + end + end +end diff --git a/qa/spec/scenario/test/integration/object_storage_spec.rb b/qa/spec/scenario/test/integration/object_storage_spec.rb new file mode 100644 index 00000000000..2b7188223e0 --- /dev/null +++ b/qa/spec/scenario/test/integration/object_storage_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +describe QA::Scenario::Test::Integration::ObjectStorage do + context '#perform' do + it_behaves_like 'a QA scenario class' do + let(:tags) { [:object_storage] } + end + end +end |