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
Boxiang Sun
gitlab-ce
Commits
438e18d8
Commit
438e18d8
authored
Aug 21, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refurbish spec/features/runners_spec.rb
parent
0f74ba96
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
92 additions
and
109 deletions
+92
-109
app/views/projects/runners/_runner.html.haml
app/views/projects/runners/_runner.html.haml
+1
-1
spec/features/runners_spec.rb
spec/features/runners_spec.rb
+91
-108
No files found.
app/views/projects/runners/_runner.html.haml
View file @
438e18d8
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
-
if
runner
.
locked?
-
if
runner
.
locked?
=
icon
(
'lock'
,
class:
'has-tooltip'
,
title:
'Locked to current projects'
)
=
icon
(
'lock'
,
class:
'has-tooltip'
,
title:
'Locked to current projects'
)
%small
%small
.edit-runner
=
link_to
edit_project_runner_path
(
@project
,
runner
)
do
=
link_to
edit_project_runner_path
(
@project
,
runner
)
do
%i
.fa.fa-edit.btn
%i
.fa.fa-edit.btn
-
else
-
else
...
...
spec/features/runners_spec.rb
View file @
438e18d8
require
'spec_helper'
require
'spec_helper'
describe
"Runners"
do
feature
'Runners'
do
let
(
:user
)
{
create
(
:user
)
}
given
(
:user
)
{
create
(
:user
)
}
b
efore
do
b
ackground
do
sign_in
(
user
)
sign_in
(
user
)
end
end
describe
"specific runners"
do
context
'when a project has enabled shared_runners'
do
before
do
given
(
:project
)
{
create
(
:project
)
}
@project
=
FactoryGirl
.
create
:project
,
shared_runners_enabled:
false
@project
.
team
<<
[
user
,
:master
]
@project2
=
FactoryGirl
.
create
:project
context
'when a specific runner is activated on the project'
do
@project2
.
team
<<
[
user
,
:master
]
given
(
:specific_runner
)
{
create
(
:ci_runner
,
:specific
)
}
@project3
=
FactoryGirl
.
create
:project
background
do
@project3
.
team
<<
[
user
,
:developer
]
project
.
add_master
(
user
)
project
.
runners
<<
specific_runner
end
@shared_runner
=
FactoryGirl
.
create
:ci_runner
,
:shared
scenario
'user sees the specific runner'
do
@specific_runner
=
FactoryGirl
.
create
:ci_runner
visit
runners_path
(
project
)
@specific_runner2
=
FactoryGirl
.
create
:ci_runner
@specific_runner3
=
FactoryGirl
.
create
:ci_runner
@project
.
runners
<<
@specific_runner
@project2
.
runners
<<
@specific_runner2
@project3
.
runners
<<
@specific_runner3
visit
runners_path
(
@project
)
within
'.activated-specific-runners'
do
expect
(
page
).
to
have_content
(
specific_runner
.
display_name
)
end
end
before
do
click_on
specific_runner
.
short_sha
expect
(
page
).
not_to
have_content
(
@specific_runner3
.
display_name
)
expect
(
page
).
not_to
have_content
(
@specific_runner3
.
display_name
)
expect
(
page
).
to
have_content
(
specific_runner
.
platform
)
end
end
it
"places runners in right places"
do
scenario
'user removes an activated specific runner'
do
expect
(
page
.
find
(
".available-specific-runners"
)).
to
have_content
(
@specific_runner2
.
display_name
)
visit
runners_path
(
project
)
expect
(
page
.
find
(
".activated-specific-runners"
)).
to
have_content
(
@specific_runner
.
display_name
)
expect
(
page
.
find
(
".available-shared-runners"
)).
to
have_content
(
@shared_runner
.
display_name
)
within
'.activated-specific-runners'
do
click_on
'Remove Runner'
end
end
it
"enables specific runner for project"
do
expect
(
page
).
to
have_no_css
(
'.activated-specific-runners'
)
within
".available-specific-runners"
do
click_on
"Enable for this project"
end
end
expect
(
page
.
find
(
".activated-specific-runners"
)).
to
have_content
(
@specific_runner2
.
display_name
)
context
'when a runner has a tag'
do
background
do
specific_runner
.
update_attribute
(
:tag_list
,
[
'tag'
])
end
end
it
"disables specific runner for project"
do
scenario
'user edits runner not to run untagged jobs'
do
@project2
.
runners
<<
@specific_runner
visit
runners_path
(
project
)
visit
runners_path
(
@project
)
within
".activated-specific-runners"
do
within
'.activated-specific-runners'
do
click_on
"Disable for this project"
first
(
'.edit-runner > a'
).
click
end
end
expect
(
page
.
find
(
".available-specific-runners"
)).
to
have_content
(
@specific_runner
.
display_name
)
expect
(
page
.
find_field
(
'runner[run_untagged]'
)).
to
be_checked
end
it
"removes specific runner for project if this is last project for that runners"
do
uncheck
'runner_run_untagged'
within
".activated-specific-runners"
do
click_button
'Save changes'
click_on
"Remove Runner"
end
expect
(
Ci
::
Runner
.
exists?
(
id:
@specific_runner
)).
to
be_falsey
expect
(
page
).
to
have_content
'Can run untagged jobs No'
end
end
end
end
describe
"shared runners"
do
context
'when a specific runner exists in another project'
do
before
do
given
(
:another_project
)
{
create
(
:project
)
}
@project
=
FactoryGirl
.
create
:project
,
shared_runners_enabled:
false
given
(
:specific_runner2
)
{
create
(
:ci_runner
,
:specific
)
}
@project
.
team
<<
[
user
,
:master
]
visit
runners_path
(
@project
)
end
it
"enables shared runners"
do
background
do
click_on
"Enable shared Runners"
another_project
.
add_master
(
user
)
expect
(
@project
.
reload
.
shared_runners_enabled
).
to
be_truthy
another_project
.
runners
<<
specific_runner2
end
end
scenario
'user enables and disables a specific runner'
do
visit
runners_path
(
project
)
within
'.available-specific-runners'
do
click_on
'Enable for this project'
end
end
describe
"shared runners description"
do
expect
(
page
.
find
(
'.activated-specific-runners'
)).
to
have_content
(
specific_runner2
.
display_name
)
let
(
:shared_runners_text
)
{
'custom **shared** runners description'
}
let
(
:shared_runners_html
)
{
'custom shared runners description'
}
before
do
within
'.activated-specific-runners'
do
stub_application_setting
(
shared_runners_text:
shared_runners_text
)
click_on
'Disable for this project'
project
=
FactoryGirl
.
create
:project
,
shared_runners_enabled:
false
project
.
team
<<
[
user
,
:master
]
visit
runners_path
(
project
)
end
end
it
"sees shared runners description"
do
expect
(
page
.
find
(
'.activated-specific-runners'
)).
not_to
have_content
(
specific_runner2
.
display_name
)
expect
(
page
.
find
(
".shared-runners-description"
)).
to
have_content
(
shared_runners_html
)
end
end
end
end
describe
"show page"
do
context
'when a shared runner is activated on the project'
do
before
do
given!
(
:shared_runner
)
{
create
(
:ci_runner
,
:shared
)
}
@project
=
FactoryGirl
.
create
:project
@project
.
team
<<
[
user
,
:master
]
scenario
'user sees CI/CD setting page'
do
@specific_runner
=
FactoryGirl
.
create
:ci_runner
visit
runners_path
(
project
)
@project
.
runners
<<
@specific_runner
end
it
"shows runner information"
do
expect
(
page
.
find
(
'.available-shared-runners'
)).
to
have_content
(
shared_runner
.
display_name
)
visit
runners_path
(
@project
)
end
click_on
@specific_runner
.
short_sha
expect
(
page
).
to
have_content
(
@specific_runner
.
platform
)
end
end
end
end
feature
'configuring runners ability to picking untagged jobs
'
do
context
'when application settings have shared_runners_text
'
do
given
(
:project
)
{
create
(
:project
)
}
given
(
:shared_runners_text
)
{
'custom **shared** runners description'
}
given
(
:runner
)
{
create
(
:ci_runner
)
}
given
(
:shared_runners_html
)
{
'custom shared runners description'
}
background
do
background
do
project
.
team
<<
[
user
,
:master
]
project
.
add_master
(
user
)
project
.
runners
<<
runner
stub_application_setting
(
shared_runners_text:
shared_runners_text
)
end
end
scenario
'user checks default configura
tion'
do
scenario
'user sees shared runners descrip
tion'
do
visit
project_runner_path
(
project
,
runner
)
visit
runners_path
(
project
)
expect
(
page
).
to
have_content
'Can run untagged jobs Yes'
expect
(
page
.
find
(
'.shared-runners-description'
)).
to
have_content
(
shared_runners_html
)
end
end
context
'when runner has tags'
do
before
do
runner
.
update_attribute
(
:tag_list
,
[
'tag'
])
end
end
scenario
'user wants to prevent runner from running untagged job'
do
visit
runners_path
(
project
)
page
.
within
(
'.activated-specific-runners'
)
do
first
(
'small > a'
).
click
end
end
uncheck
'runner_run_untagged'
context
'when a project has disabled shared_runners'
do
click_button
'Save changes'
given
(
:project
)
{
create
(
:project
,
shared_runners_enabled:
false
)
}
expect
(
page
).
to
have_content
'Can run untagged jobs No'
background
do
expect
(
runner
.
reload
.
run_untagged?
).
to
eq
false
project
.
add_master
(
user
)
end
end
scenario
'user enables shared runners'
do
visit
runners_path
(
project
)
click_on
'Enable shared Runners'
expect
(
page
.
find
(
'.shared-runners-description'
)).
to
have_content
(
'Disable shared Runners'
)
end
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