Commit 2d05cf40 authored by Richard Clamp's avatar Richard Clamp

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.
parent d6044a10
...@@ -5,10 +5,17 @@ module QA ...@@ -5,10 +5,17 @@ module QA
# including staging and on-premises installation. # including staging and on-premises installation.
# #
class Entrypoint < Template 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) def perform(address, *files)
Specs::Config.perform do |specs| Specs::Config.perform do |specs|
specs.address = address specs.address = address
configure_specs(specs)
end end
## ##
...@@ -17,13 +24,9 @@ module QA ...@@ -17,13 +24,9 @@ module QA
Runtime::Release.perform_before_hooks Runtime::Release.perform_before_hooks
Specs::Runner.perform do |specs| 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
end end
protected
def configure_specs(specs) end
end end
end end
end end
...@@ -6,6 +6,7 @@ module QA ...@@ -6,6 +6,7 @@ module QA
# including staging and on-premises installation. # including staging and on-premises installation.
# #
class Instance < Entrypoint class Instance < Entrypoint
tags :core
end end
end end
end end
......
...@@ -7,11 +7,7 @@ module QA ...@@ -7,11 +7,7 @@ module QA
# including staging and on-premises installation. # including staging and on-premises installation.
# #
class Mattermost < Scenario::Entrypoint class Mattermost < Scenario::Entrypoint
protected tags :core, :mattermost
def configure_specs(specs)
specs.exclusion_filter[:mattermost] = false
end
end end
end end
end end
......
...@@ -10,7 +10,6 @@ module QA ...@@ -10,7 +10,6 @@ module QA
module Specs module Specs
class Config < Scenario::Template class Config < Scenario::Template
attr_writer :address attr_writer :address
attr_accessor :exclusion_filter
def initialize def initialize
@address = ENV['GITLAB_URL'] @address = ENV['GITLAB_URL']
...@@ -34,7 +33,9 @@ module QA ...@@ -34,7 +33,9 @@ module QA
mocks.verify_partial_doubles = true mocks.verify_partial_doubles = true
end 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| config.define_derived_metadata(file_path: %r{/specs/features/mattermost/}) do |metadata|
metadata[:mattermost] = true metadata[:mattermost] = true
......
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