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
03ff1da2
Commit
03ff1da2
authored
May 23, 2018
by
Kamil Trzciński
Committed by
Dylan Griffith
May 31, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix some failures
parent
1fcc9ad7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
40 deletions
+9
-40
app/models/clusters/applications/runner.rb
app/models/clusters/applications/runner.rb
+3
-2
spec/factories/ci/runners.rb
spec/factories/ci/runners.rb
+4
-0
spec/requests/api/runners_spec.rb
spec/requests/api/runners_spec.rb
+2
-38
No files found.
app/models/clusters/applications/runner.rb
View file @
03ff1da2
...
...
@@ -43,7 +43,7 @@ module Clusters
def
create_and_assign_runner
transaction
do
project
.
runners
.
create!
(
runner_create_params
).
tap
do
|
runner
|
Ci
::
Runner
.
create!
(
runner_create_params
).
tap
do
|
runner
|
update!
(
runner_id:
runner
.
id
)
end
end
...
...
@@ -53,7 +53,8 @@ module Clusters
{
name:
'kubernetes-cluster'
,
runner_type: :project_type
,
tag_list:
%w(kubernetes cluster)
tag_list:
%w(kubernetes cluster)
,
projects:
[
project
]
}
end
...
...
spec/factories/ci/runners.rb
View file @
03ff1da2
...
...
@@ -9,6 +9,10 @@ FactoryBot.define do
is_shared
true
runner_type
:instance_type
trait
:online
do
contacted_at
Time
.
now
end
trait
:instance
do
is_shared
true
runner_type
:instance_type
...
...
spec/requests/api/runners_spec.rb
View file @
03ff1da2
...
...
@@ -12,21 +12,8 @@ describe API::Runners do
let
(
:group2
)
{
create
(
:group
).
tap
{
|
group
|
group
.
add_owner
(
user
)
}
}
let!
(
:shared_runner
)
{
create
(
:ci_runner
,
:instance
,
description:
'Shared runner'
)
}
let!
(
:unused_project_runner
)
{
create
(
:ci_runner
)
}
let!
(
:project_runner
)
do
create
(
:ci_runner
,
description:
'Project runner'
).
tap
do
|
runner
|
create
(
:ci_runner_project
,
runner:
runner
,
project:
project
)
end
end
let!
(
:two_projects_runner
)
do
create
(
:ci_runner
,
description:
'Two projects runner'
).
tap
do
|
runner
|
create
(
:ci_runner_project
,
runner:
runner
,
project:
project
)
create
(
:ci_runner_project
,
runner:
runner
,
project:
project2
)
end
end
let!
(
:project_runner
)
{
create
(
:ci_runner
,
:project
,
description:
'Project runner'
,
projects:
[
project
])
}
let!
(
:two_projects_runner
)
{
create
(
:ci_runner
,
:project
,
description:
'Two projects runner'
,
projects:
[
project
,
project2
])
let!
(
:group_runner
)
{
create
(
:ci_runner
,
:group
,
description:
'Group runner'
,
groups:
[
group
])
}
before
do
...
...
@@ -310,14 +297,6 @@ describe API::Runners do
end
context
'when runner is not shared'
do
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
it
'deletes used project runner'
do
expect
do
delete
api
(
"/runners/
#{
project_runner
.
id
}
"
,
admin
)
...
...
@@ -586,13 +565,6 @@ describe API::Runners do
end
context
'user is admin'
do
it
'enables any specific runner'
do
expect
do
post
api
(
"/projects/
#{
project
.
id
}
/runners"
,
admin
),
runner_id:
unused_project_runner
.
id
end
.
to
change
{
project
.
runners
.
count
}.
by
(
+
1
)
expect
(
response
).
to
have_gitlab_http_status
(
201
)
end
it
'enables a shared runner'
do
expect
do
post
api
(
"/projects/
#{
project
.
id
}
/runners"
,
admin
),
runner_id:
shared_runner
.
id
...
...
@@ -603,14 +575,6 @@ describe API::Runners do
end
end
context
'user is not admin'
do
it
'does not enable runner without access to'
do
post
api
(
"/projects/
#{
project
.
id
}
/runners"
,
user
),
runner_id:
unused_project_runner
.
id
expect
(
response
).
to
have_gitlab_http_status
(
403
)
end
end
it
'raises an error when no runner_id param is provided'
do
post
api
(
"/projects/
#{
project
.
id
}
/runners"
,
admin
)
...
...
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