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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
50a82f64
Commit
50a82f64
authored
Jan 22, 2018
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add end-to-end test for registering GitLab Runner
parent
d0b08f1c
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
166 additions
and
16 deletions
+166
-16
qa/qa.rb
qa/qa.rb
+4
-1
qa/qa/factory/resource/deploy_key.rb
qa/qa/factory/resource/deploy_key.rb
+1
-1
qa/qa/factory/resource/runner.rb
qa/qa/factory/resource/runner.rb
+52
-0
qa/qa/page/menu/side.rb
qa/qa/page/menu/side.rb
+21
-4
qa/qa/page/project/settings/ci_cd.rb
qa/qa/page/project/settings/ci_cd.rb
+21
-0
qa/qa/page/project/settings/common.rb
qa/qa/page/project/settings/common.rb
+10
-0
qa/qa/page/project/settings/runners.rb
qa/qa/page/project/settings/runners.rb
+19
-0
qa/qa/service/runner.rb
qa/qa/service/runner.rb
+21
-10
qa/qa/specs/features/project/pipelines_spec.rb
qa/qa/specs/features/project/pipelines_spec.rb
+17
-0
No files found.
qa/qa.rb
View file @
50a82f64
...
...
@@ -26,6 +26,7 @@ module QA
autoload
:Group
,
'qa/factory/resource/group'
autoload
:Project
,
'qa/factory/resource/project'
autoload
:DeployKey
,
'qa/factory/resource/deploy_key'
autoload
:Runner
,
'qa/factory/resource/runner'
end
module
Repository
...
...
@@ -104,7 +105,9 @@ module QA
module
Settings
autoload
:Common
,
'qa/page/project/settings/common'
autoload
:Repository
,
'qa/page/project/settings/repository'
autoload
:CICD
,
'qa/page/project/settings/ci_cd'
autoload
:DeployKeys
,
'qa/page/project/settings/deploy_keys'
autoload
:Runners
,
'qa/page/project/settings/runners'
end
end
...
...
@@ -130,7 +133,7 @@ module QA
# with these services, like through the shell.
#
module
Service
autoload
:Shell
able
,
'qa/service/shellable
'
autoload
:Shell
out
,
'qa/service/shellout
'
autoload
:Omnibus
,
'qa/service/omnibus'
autoload
:Runner
,
'qa/service/runner'
end
...
...
qa/qa/factory/resource/deploy_key.rb
View file @
50a82f64
...
...
@@ -13,7 +13,7 @@ module QA
project
.
visit!
Page
::
Menu
::
Side
.
act
do
click_repository_setting
click_repository_setting
s
end
Page
::
Project
::
Settings
::
Repository
.
perform
do
|
setting
|
...
...
qa/qa/factory/resource/runner.rb
0 → 100644
View file @
50a82f64
require
'securerandom'
module
QA
module
Factory
module
Resource
class
Runner
<
Factory
::
Base
attr_writer
:name
dependency
Factory
::
Resource
::
Project
,
as: :project
do
|
project
|
project
.
name
=
'project-with-ci-cd'
project
.
description
=
'Project with CI/CD Pipelines'
end
def
name
@name
||
"qa-runner-
#{
SecureRandom
.
hex
(
4
)
}
"
end
def
perform
(
&
block
)
@block
||=
block
end
def
fabricate!
project
.
visit!
Page
::
Menu
::
Side
.
act
{
click_ci_cd_settings
}
Service
::
Runner
.
perform
do
|
runner
|
Page
::
Project
::
Settings
::
CICD
.
perform
do
|
settings
|
settings
.
expand_runners_settings
do
|
runners
|
runner
.
pull
runner
.
name
=
name
runner
.
token
=
runners
.
registration_token
runner
.
address
=
runners
.
coordinator_address
runner
.
tags
=
%w[qa test]
runner
.
register!
end
sleep
5
# TODO, non-blocking waiting for Runner to register.
settings
.
refresh
settings
.
expand_runners_settings
do
|
runners
|
perform
&
.
call
(
runners
)
runner
.
remove!
end
end
end
end
end
end
end
end
qa/qa/page/menu/side.rb
View file @
50a82f64
...
...
@@ -5,18 +5,29 @@ module QA
view
'app/views/layouts/nav/sidebar/_project.html.haml'
do
element
:settings_item
element
:repository_link
,
"title: 'Repository'"
element
:repository_link
,
"title: 'CI / CD'"
element
:top_level_items
,
'.sidebar-top-level-items'
end
def
click_repository_setting
hover_setting
do
click_link
(
'Repository'
)
def
click_repository_settings
hover_settings
do
within_submenu
do
click_link
(
'Repository'
)
end
end
end
def
click_ci_cd_settings
hover_settings
do
within_submenu
do
click_link
(
'CI / CD'
)
end
end
end
private
def
hover_setting
def
hover_setting
s
within_sidebar
do
find
(
'.qa-settings-item'
).
hover
...
...
@@ -29,6 +40,12 @@ module QA
yield
end
end
def
within_submenu
page
.
within
(
'.fly-out-list'
)
do
yield
end
end
end
end
end
...
...
qa/qa/page/project/settings/ci_cd.rb
0 → 100644
View file @
50a82f64
module
QA
module
Page
module
Project
module
Settings
class
CICD
<
Page
::
Base
include
Common
view
'app/views/projects/settings/ci_cd/show.html.haml'
do
element
:runners_settings
,
'Runners settings'
end
def
expand_runners_settings
(
&
block
)
expand_section
(
'Runners settings'
)
do
Settings
::
Runners
.
perform
(
&
block
)
end
end
end
end
end
end
end
qa/qa/page/project/settings/common.rb
View file @
50a82f64
...
...
@@ -10,6 +10,16 @@ module QA
yield
end
end
def
expand_section
(
name
)
page
.
within
(
'#content-body'
)
do
page
.
within
(
'section'
,
text:
name
)
do
click_button
'Expand'
yield
end
end
end
end
end
end
...
...
qa/qa/page/project/settings/runners.rb
0 → 100644
View file @
50a82f64
module
QA
module
Page
module
Project
module
Settings
class
Runners
<
Page
::
Base
def
registration_token
find
(
'code#registration_token'
).
text
end
def
coordinator_address
# TODO, this needs a specific ID or QA class
#
all
(
'code'
).
first
.
text
end
end
end
end
end
end
qa/qa/service/runner.rb
View file @
50a82f64
require
'securerandom'
module
QA
module
Service
class
Runner
include
Scenario
::
Actable
include
Service
::
Shellout
def
initialize
(
image
)
@image
=
image
attr_writer
:token
,
:address
,
:tags
,
:image
,
:name
def
initialize
@image
=
'gitlab/gitlab-runner:alpine'
@name
=
"gitlab-runner-qa-
#{
SecureRandom
.
hex
(
4
)
}
"
end
def
pull
shell
"docker pull
#{
@image
}
"
end
def
register
(
token
)
raise
NotImplementedError
end
def
run
raise
NotImplementedError
def
register!
shell
<<~
CMD
.
tr
(
"
\n
"
,
' '
)
docker run -d --rm --entrypoint=/bin/sh
--network test --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_NAME=
#{
@name
}
#{
@image
}
-c 'gitlab-runner register && gitlab-runner run'
CMD
end
def
remove
raise
NotImplementedError
def
remove
!
shell
"docker rm -f
#{
@name
}
"
end
end
end
...
...
qa/qa/specs/features/project/pipelines_spec.rb
0 → 100644
View file @
50a82f64
module
QA
feature
'CI/CD Pipelines'
,
:core
,
:docker
do
scenario
'user registers a new specific runner'
do
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
Factory
::
Resource
::
Runner
.
fabricate!
do
|
runner
|
runner
.
name
=
'my-qa-runner'
runner
.
perform
do
|
page
|
expect
(
page
).
to
have_content
(
'my-qa-runner'
)
expect
(
page
).
to
have_css
(
'.runner-status-online'
)
end
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