From 60e8347c7f9cbd689f014fa5d633ffa3276d9650 Mon Sep 17 00:00:00 2001 From: Richard Clamp Date: Wed, 11 Oct 2017 15:19:24 +0100 Subject: Add Test::Integration::Mattermost Here we add a new entrypoint for the test suite, Test::Integration::Mattermost. It is to ensure that mattermost integration is working when enabling the embedded mattermost of gitlab-omnibus It runs all the example groups from Test::Instance, in addition to any groups tagged :mattermost * Extracts a common entrypoint class from Test::Instance as Scenario::Entrypoint, and uses that as the base for Test::Instance and Test::Integration::Mattermost * RSpec groups defined in `specs/features/mattermost/**_spec.rb` are tagged with :mattermost so they can be filtered out of the default run. * Tests tagged :mattermost are filtered out by default, and are un-filtered by Test::Integration::Mattermost --- qa/qa.rb | 5 ++++ qa/qa/scenario/entrypoint.rb | 29 ++++++++++++++++++++++ qa/qa/scenario/test/instance.rb | 16 +----------- qa/qa/scenario/test/integration/mattermost.rb | 19 ++++++++++++++ qa/qa/specs/config.rb | 8 ++++++ .../specs/features/mattermost/group_create_spec.rb | 16 ++++++++++++ 6 files changed, 78 insertions(+), 15 deletions(-) create mode 100644 qa/qa/scenario/entrypoint.rb create mode 100644 qa/qa/scenario/test/integration/mattermost.rb create mode 100644 qa/qa/specs/features/mattermost/group_create_spec.rb (limited to 'qa') diff --git a/qa/qa.rb b/qa/qa.rb index eb6f922d0d3..59d9dd131c2 100644 --- a/qa/qa.rb +++ b/qa/qa.rb @@ -18,6 +18,7 @@ module QA # Support files # autoload :Actable, 'qa/scenario/actable' + autoload :Entrypoint, 'qa/scenario/entrypoint' autoload :Template, 'qa/scenario/template' ## @@ -25,6 +26,10 @@ module QA # module Test autoload :Instance, 'qa/scenario/test/instance' + + module Integration + autoload :Mattermost, 'qa/scenario/test/integration/mattermost' + end end ## diff --git a/qa/qa/scenario/entrypoint.rb b/qa/qa/scenario/entrypoint.rb new file mode 100644 index 00000000000..b47fae2604c --- /dev/null +++ b/qa/qa/scenario/entrypoint.rb @@ -0,0 +1,29 @@ +module QA + module Scenario + ## + # Run test suite against any Gitlab instance, + # including staging and on-premises installation. + # + class Entrypoint < Template + def perform(address, *files) + Specs::Config.perform do |specs| + specs.address = address + configure_specs(specs) + end + + ## + # Perform before hooks, which are different for CE and EE + # + Runtime::Release.perform_before_hooks + + Specs::Runner.perform do |specs| + specs.rspec('--tty', 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 689292bc60b..115462d8e6b 100644 --- a/qa/qa/scenario/test/instance.rb +++ b/qa/qa/scenario/test/instance.rb @@ -5,21 +5,7 @@ module QA # Run test suite against any GitLab instance, # including staging and on-premises installation. # - class Instance < Scenario::Template - def perform(address, *files) - Specs::Config.perform do |specs| - specs.address = address - end - - ## - # Perform before hooks, which are different for CE and EE - # - Runtime::Release.perform_before_hooks - - Specs::Runner.perform do |specs| - specs.rspec('--tty', files.any? ? files : 'qa/specs/features') - end - end + class Instance < Entrypoint end end end diff --git a/qa/qa/scenario/test/integration/mattermost.rb b/qa/qa/scenario/test/integration/mattermost.rb new file mode 100644 index 00000000000..be371cca6ff --- /dev/null +++ b/qa/qa/scenario/test/integration/mattermost.rb @@ -0,0 +1,19 @@ +module QA + module Scenario + module Test + module Integration + ## + # Run test suite against any GitLab instance where mattermost is enabled, + # including staging and on-premises installation. + # + class Mattermost < Scenario::Entrypoint + protected + + def configure_specs(specs) + specs.exclusion_filter[:mattermost] = false + end + end + end + end + end +end diff --git a/qa/qa/specs/config.rb b/qa/qa/specs/config.rb index 79c681168cc..bff8c974047 100644 --- a/qa/qa/specs/config.rb +++ b/qa/qa/specs/config.rb @@ -10,9 +10,11 @@ module QA module Specs class Config < Scenario::Template attr_writer :address + attr_accessor :exclusion_filter def initialize @address = ENV['GITLAB_URL'] + @exclusion_filter = { mattermost: true } end def perform @@ -32,6 +34,12 @@ 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[:mattermost] = true + end + config.order = :random Kernel.srand config.seed config.formatter = :documentation diff --git a/qa/qa/specs/features/mattermost/group_create_spec.rb b/qa/qa/specs/features/mattermost/group_create_spec.rb new file mode 100644 index 00000000000..f05eee2337b --- /dev/null +++ b/qa/qa/specs/features/mattermost/group_create_spec.rb @@ -0,0 +1,16 @@ +module QA + feature 'create a new group' do + scenario 'creating a group with a mattermost team' do + Page::Main::Entry.act { sign_in_using_credentials } + Page::Main::Menu.act { go_to_groups } + + Page::Dashboard::Groups.perform do |page| + page.go_to_new_group + + expect(page).to have_content( + /Create a Mattermost team for this group/ + ) + end + end + end +end -- cgit v1.2.3