Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
5cb94835
Commit
5cb94835
authored
Jan 23, 2018
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor QA instance test scenario and tags
parent
738bad8e
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
41 additions
and
46 deletions
+41
-46
qa/qa.rb
qa/qa.rb
+1
-1
qa/qa/scenario/entrypoint.rb
qa/qa/scenario/entrypoint.rb
+0
-34
qa/qa/scenario/taggable.rb
qa/qa/scenario/taggable.rb
+13
-0
qa/qa/scenario/test/instance.rb
qa/qa/scenario/test/instance.rb
+20
-2
qa/qa/scenario/test/integration/mattermost.rb
qa/qa/scenario/test/integration/mattermost.rb
+1
-1
qa/qa/service/runner.rb
qa/qa/service/runner.rb
+4
-6
qa/spec/scenario/test/instance_spec.rb
qa/spec/scenario/test/instance_spec.rb
+2
-2
No files found.
qa/qa.rb
View file @
5cb94835
...
@@ -47,7 +47,7 @@ module QA
...
@@ -47,7 +47,7 @@ module QA
#
#
autoload
:Bootable
,
'qa/scenario/bootable'
autoload
:Bootable
,
'qa/scenario/bootable'
autoload
:Actable
,
'qa/scenario/actable'
autoload
:Actable
,
'qa/scenario/actable'
autoload
:
Entrypoint
,
'qa/scenario/entrypoint
'
autoload
:
Taggable
,
'qa/scenario/taggable
'
autoload
:Template
,
'qa/scenario/template'
autoload
:Template
,
'qa/scenario/template'
##
##
...
...
qa/qa/scenario/entrypoint.rb
deleted
100644 → 0
View file @
738bad8e
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
qa/qa/scenario/taggable.rb
0 → 100644
View file @
5cb94835
module
QA
module
Scenario
module
Taggable
def
tags
(
*
tags
)
@tags
=
tags
end
def
focus
@tags
.
to_a
end
end
end
end
qa/qa/scenario/test/instance.rb
View file @
5cb94835
...
@@ -2,11 +2,29 @@ module QA
...
@@ -2,11 +2,29 @@ module QA
module
Scenario
module
Scenario
module
Test
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.
# including staging and on-premises installation.
#
#
class
Instance
<
Entrypoint
class
Instance
<
Template
include
Bootable
extend
Taggable
tags
:core
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
end
end
end
...
...
qa/qa/scenario/test/integration/mattermost.rb
View file @
5cb94835
...
@@ -6,7 +6,7 @@ module QA
...
@@ -6,7 +6,7 @@ module QA
# Run test suite against any GitLab instance where mattermost is enabled,
# Run test suite against any GitLab instance where mattermost is enabled,
# including staging and on-premises installation.
# including staging and on-premises installation.
#
#
class
Mattermost
<
Scenario
::
Entrypoint
class
Mattermost
<
Test
::
Instance
tags
:core
,
:mattermost
tags
:core
,
:mattermost
def
perform
(
address
,
mattermost
,
*
files
)
def
perform
(
address
,
mattermost
,
*
files
)
...
...
qa/qa/service/runner.rb
View file @
5cb94835
...
@@ -11,6 +11,8 @@ module QA
...
@@ -11,6 +11,8 @@ module QA
def
initialize
(
name
)
def
initialize
(
name
)
@image
=
'gitlab/gitlab-runner:alpine'
@image
=
'gitlab/gitlab-runner:alpine'
@name
=
name
||
"qa-runner-
#{
SecureRandom
.
hex
(
4
)
}
"
@name
=
name
||
"qa-runner-
#{
SecureRandom
.
hex
(
4
)
}
"
@network
=
Runtime
::
Scenario
.
attributes
[
:network
]
||
'test'
@tags
=
%w[qa test]
end
end
def
pull
def
pull
...
@@ -18,18 +20,14 @@ module QA
...
@@ -18,18 +20,14 @@ module QA
end
end
def
register!
def
register!
##
# TODO, this assumes that `test` network exists, because we know that
# gitlab-qa environment orchestration tool creates it.
#
shell
<<~
CMD
.
tr
(
"
\n
"
,
' '
)
shell
<<~
CMD
.
tr
(
"
\n
"
,
' '
)
docker run -d --rm --entrypoint=/bin/sh
docker run -d --rm --entrypoint=/bin/sh
--network
test
--name
#{
@name
}
--network
#{
@network
}
--name
#{
@name
}
-e CI_SERVER_URL=
#{
@address
}
-e CI_SERVER_URL=
#{
@address
}
-e REGISTER_NON_INTERACTIVE=true
-e REGISTER_NON_INTERACTIVE=true
-e REGISTRATION_TOKEN=
#{
@token
}
-e REGISTRATION_TOKEN=
#{
@token
}
-e RUNNER_EXECUTOR=shell
-e RUNNER_EXECUTOR=shell
-e RUNNER_TAG_LIST=
#{
@tags
.
to_a
.
join
(
','
)
}
-e RUNNER_TAG_LIST=
#{
@tags
.
join
(
','
)
}
-e RUNNER_NAME=
#{
@name
}
-e RUNNER_NAME=
#{
@name
}
#{
@image
}
-c 'gitlab-runner register && gitlab-runner run'
#{
@image
}
-c 'gitlab-runner register && gitlab-runner run'
CMD
CMD
...
...
qa/spec/scenario/
entrypoint
_spec.rb
→
qa/spec/scenario/
test/instance
_spec.rb
View file @
5cb94835
describe
QA
::
Scenario
::
Entrypoint
do
describe
QA
::
Scenario
::
Test
::
Instance
do
subject
do
subject
do
Class
.
new
(
QA
::
Scenario
::
Entrypoint
)
do
Class
.
new
(
described_class
)
do
tags
:rspec
tags
:rspec
end
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment