diff options
author | Richard Clamp <richardc@unixbeard.net> | 2017-10-13 17:33:18 +0300 |
---|---|---|
committer | Richard Clamp <richardc@unixbeard.net> | 2017-10-13 17:50:11 +0300 |
commit | 2d05cf40d102e0b99d2bd03347c3b8510af6e331 (patch) | |
tree | 923adc34a731609a58d3804dff19d2afe52cb3fc | |
parent | d6044a10f1d173e04fd2f4d69f6ebc1df34630be (diff) |
Simplify tag specification
As suggested by Grzegorz, we can be more declarative in our
configuration of the tags the Entrypoint cares about
Here we add a tags method to the entrypoint class, and use that to
declare the tags an entrypoint is interested in (:core for the existing
Test::Instance, :core and :mattermost for Test::Integration::Mattermost)
We declare everything in specs/features that isn't in
specs/features/mattermost, to have the tag :core, though that clean up
better if we move the integration tests out of specs/features.
-rw-r--r-- | qa/qa/scenario/entrypoint.rb | 15 | ||||
-rw-r--r-- | qa/qa/scenario/test/instance.rb | 1 | ||||
-rw-r--r-- | qa/qa/scenario/test/integration/mattermost.rb | 6 | ||||
-rw-r--r-- | qa/qa/specs/config.rb | 5 |
4 files changed, 14 insertions, 13 deletions
diff --git a/qa/qa/scenario/entrypoint.rb b/qa/qa/scenario/entrypoint.rb index d536ee71b60..6d205cc6e2f 100644 --- a/qa/qa/scenario/entrypoint.rb +++ b/qa/qa/scenario/entrypoint.rb @@ -5,10 +5,17 @@ module QA # including staging and on-premises installation. # class Entrypoint < Template + def self.tags(*tags) + @tags = tags + end + + def self.tag_switches + @tags.map { |tag| ['-t', tag.to_s] } + end + def perform(address, *files) Specs::Config.perform do |specs| specs.address = address - configure_specs(specs) end ## @@ -17,13 +24,9 @@ module QA Runtime::Release.perform_before_hooks Specs::Runner.perform do |specs| - specs.rspec('--tty', files.any? ? files : 'qa/specs/features') + specs.rspec('--tty', self.class.tag_switches, files.any? ? files : 'qa/specs/features') end end - - protected - - def configure_specs(specs) end end end end diff --git a/qa/qa/scenario/test/instance.rb b/qa/qa/scenario/test/instance.rb index 115462d8e6b..e2a1f6bf2bd 100644 --- a/qa/qa/scenario/test/instance.rb +++ b/qa/qa/scenario/test/instance.rb @@ -6,6 +6,7 @@ module QA # including staging and on-premises installation. # class Instance < Entrypoint + tags :core end end end diff --git a/qa/qa/scenario/test/integration/mattermost.rb b/qa/qa/scenario/test/integration/mattermost.rb index be371cca6ff..4732f2b635b 100644 --- a/qa/qa/scenario/test/integration/mattermost.rb +++ b/qa/qa/scenario/test/integration/mattermost.rb @@ -7,11 +7,7 @@ module QA # including staging and on-premises installation. # class Mattermost < Scenario::Entrypoint - protected - - def configure_specs(specs) - specs.exclusion_filter[:mattermost] = false - end + tags :core, :mattermost end end end diff --git a/qa/qa/specs/config.rb b/qa/qa/specs/config.rb index bff8c974047..09dcd3d3a23 100644 --- a/qa/qa/specs/config.rb +++ b/qa/qa/specs/config.rb @@ -10,7 +10,6 @@ module QA module Specs class Config < Scenario::Template attr_writer :address - attr_accessor :exclusion_filter def initialize @address = ENV['GITLAB_URL'] @@ -34,7 +33,9 @@ module QA mocks.verify_partial_doubles = true end - config.exclusion_filter = @exclusion_filter + config.define_derived_metadata(file_path: %r{/specs/features/(?!mattermost/)}) do |metadata| + metadata[:core] = true + end config.define_derived_metadata(file_path: %r{/specs/features/mattermost/}) do |metadata| metadata[:mattermost] = true |