Skip to content
Snippets Groups Projects
Commit 5cb94835 authored by Grzegorz Bizon's avatar Grzegorz Bizon
Browse files

Refactor QA instance test scenario and tags

parent 738bad8e
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -47,7 +47,7 @@ module QA
#
autoload :Bootable, 'qa/scenario/bootable'
autoload :Actable, 'qa/scenario/actable'
autoload :Entrypoint, 'qa/scenario/entrypoint'
autoload :Taggable, 'qa/scenario/taggable'
autoload :Template, 'qa/scenario/template'
 
##
Loading
Loading
module QA
module Scenario
##
# Base class for running the suite against any GitLab instance,
# including staging and on-premises installation.
#
class Entrypoint < Template
include Bootable
def perform(address, *files)
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.get_tags
specs.files = files.any? ? files : 'qa/specs/features'
end
end
def self.tags(*tags)
@tags = tags
end
def self.get_tags
@tags
end
end
end
end
module QA
module Scenario
module Taggable
def tags(*tags)
@tags = tags
end
def focus
@tags.to_a
end
end
end
end
Loading
Loading
@@ -2,11 +2,29 @@ module QA
module Scenario
module Test
##
# Run test suite against any GitLab instance,
# Base class for running the suite against any GitLab instance,
# including staging and on-premises installation.
#
class Instance < Entrypoint
class Instance < Template
include Bootable
extend Taggable
tags :core
def perform(address, *files)
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.files = files.any? ? files : 'qa/specs/features'
end
end
end
end
end
Loading
Loading
Loading
Loading
@@ -6,7 +6,7 @@ module QA
# Run test suite against any GitLab instance where mattermost is enabled,
# including staging and on-premises installation.
#
class Mattermost < Scenario::Entrypoint
class Mattermost < Test::Instance
tags :core, :mattermost
 
def perform(address, mattermost, *files)
Loading
Loading
Loading
Loading
@@ -11,6 +11,8 @@ module QA
def initialize(name)
@image = 'gitlab/gitlab-runner:alpine'
@name = name || "qa-runner-#{SecureRandom.hex(4)}"
@network = Runtime::Scenario.attributes[:network] || 'test'
@tags = %w[qa test]
end
 
def pull
Loading
Loading
@@ -18,18 +20,14 @@ module QA
end
 
def register!
##
# TODO, this assumes that `test` network exists, because we know that
# gitlab-qa environment orchestration tool creates it.
#
shell <<~CMD.tr("\n", ' ')
docker run -d --rm --entrypoint=/bin/sh
--network test --name #{@name}
--network #{@network} --name #{@name}
-e CI_SERVER_URL=#{@address}
-e REGISTER_NON_INTERACTIVE=true
-e REGISTRATION_TOKEN=#{@token}
-e RUNNER_EXECUTOR=shell
-e RUNNER_TAG_LIST=#{@tags.to_a.join(',')}
-e RUNNER_TAG_LIST=#{@tags.join(',')}
-e RUNNER_NAME=#{@name}
#{@image} -c 'gitlab-runner register && gitlab-runner run'
CMD
Loading
Loading
describe QA::Scenario::Entrypoint do
describe QA::Scenario::Test::Instance do
subject do
Class.new(QA::Scenario::Entrypoint) do
Class.new(described_class) do
tags :rspec
end
end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment