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
c0c5f896
Commit
c0c5f896
authored
May 28, 2018
by
Kamil Trzciński
Committed by
Dylan Griffith
May 31, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bring back deleted specs
parent
47c11248
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
5 deletions
+42
-5
spec/factories/ci/runners.rb
spec/factories/ci/runners.rb
+8
-0
spec/models/ci/runner_spec.rb
spec/models/ci/runner_spec.rb
+1
-5
spec/requests/api/runners_spec.rb
spec/requests/api/runners_spec.rb
+33
-0
No files found.
spec/factories/ci/runners.rb
View file @
c0c5f896
...
...
@@ -36,6 +36,14 @@ FactoryBot.define do
end
end
trait
:without_projects
do
# we use that to create invalid runner:
# the one without projects
after
(
:create
)
do
|
runner
,
evaluator
|
runner
.
runner_projects
.
delete_all
end
end
trait
:inactive
do
active
false
end
...
...
spec/models/ci/runner_spec.rb
View file @
c0c5f896
...
...
@@ -766,11 +766,7 @@ describe Ci::Runner do
end
describe
'project runner without projects is destroyable'
do
subject
{
create
(
:ci_runner
,
:project
)
}
before
do
subject
.
runner_projects
.
delete_all
end
subject
{
create
(
:ci_runner
,
:project
,
:without_projects
)
}
it
'does not have projects'
do
expect
(
subject
.
runner_projects
).
to
be_empty
...
...
spec/requests/api/runners_spec.rb
View file @
c0c5f896
...
...
@@ -128,6 +128,18 @@ describe API::Runners do
end
context
'when runner is not shared'
do
context
'when unused runner is present'
do
let!
(
:unused_project_runner
)
{
create
(
:ci_runner
,
:project
,
:without_projects
)
}
it
'deletes unused runner'
do
expect
do
delete
api
(
"/runners/
#{
unused_project_runner
.
id
}
"
,
admin
)
expect
(
response
).
to
have_gitlab_http_status
(
204
)
end
.
to
change
{
Ci
::
Runner
.
specific
.
count
}.
by
(
-
1
)
end
end
it
"returns runner's details"
do
get
api
(
"/runners/
#{
project_runner
.
id
}
"
,
admin
)
...
...
@@ -561,6 +573,17 @@ describe API::Runners do
end
context
'user is admin'
do
context
'when project runner is used'
do
let!
(
:new_project_runner
)
{
create
(
:ci_runner
,
:project
)
}
it
'enables any specific runner'
do
expect
do
post
api
(
"/projects/
#{
project
.
id
}
/runners"
,
admin
),
runner_id:
new_project_runner
.
id
end
.
to
change
{
project
.
runners
.
count
}.
by
(
+
1
)
expect
(
response
).
to
have_gitlab_http_status
(
201
)
end
end
it
'enables a shared runner'
do
expect
do
post
api
(
"/projects/
#{
project
.
id
}
/runners"
,
admin
),
runner_id:
shared_runner
.
id
...
...
@@ -578,6 +601,16 @@ describe API::Runners do
end
end
context
'user is not admin'
do
let!
(
:new_project_runner
)
{
create
(
:ci_runner
,
:project
)
}
it
'does not enable runner without access to'
do
post
api
(
"/projects/
#{
project
.
id
}
/runners"
,
user
),
runner_id:
new_project_runner
.
id
expect
(
response
).
to
have_gitlab_http_status
(
403
)
end
end
context
'authorized user without permissions'
do
it
'does not enable runner'
do
post
api
(
"/projects/
#{
project
.
id
}
/runners"
,
user2
)
...
...
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