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
32a9c85b
Commit
32a9c85b
authored
Sep 25, 2017
by
Alexis Reigel
Committed by
Alexis Reigel
Apr 23, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
revert support for v3 api
parent
850e327c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
46 deletions
+12
-46
lib/api/v3/runners.rb
lib/api/v3/runners.rb
+0
-1
spec/requests/api/v3/runners_spec.rb
spec/requests/api/v3/runners_spec.rb
+12
-45
No files found.
lib/api/v3/runners.rb
View file @
32a9c85b
...
...
@@ -54,7 +54,6 @@ module API
forbidden!
(
"Runner is shared"
)
if
runner
.
is_shared?
forbidden!
(
"Runner associated with more than one project"
)
if
runner
.
projects
.
count
>
1
forbidden!
(
"Runner associated with more that one group"
)
if
runner
.
groups
.
count
>
1
forbidden!
(
"No access granted"
)
unless
user_can_access_runner?
(
runner
)
end
...
...
spec/requests/api/v3/runners_spec.rb
View file @
32a9c85b
...
...
@@ -8,16 +8,10 @@ describe API::V3::Runners do
let
(
:project
)
{
create
(
:project
,
creator_id:
user
.
id
)
}
let
(
:project2
)
{
create
(
:project
,
creator_id:
user
.
id
)
}
let
(
:group
)
{
create
(
:group
).
tap
{
|
group
|
group
.
add_owner
(
user
)
}
}
let
(
:group2
)
{
create
(
:group
).
tap
{
|
group
|
group
.
add_owner
(
user
)
}
}
let!
(
:group_runner
)
{
create
(
:ci_runner
,
description:
'Group runner'
,
groups:
[
group
])
}
let!
(
:two_groups_runner
)
{
create
(
:ci_runner
,
description:
'Two groups runner'
,
groups:
[
group
,
group2
])
}
let!
(
:shared_runner
)
{
create
(
:ci_runner
,
:shared
)
}
let!
(
:unused_specific_runner
)
{
create
(
:ci_runner
)
}
let!
(
:
project
_runner
)
do
let!
(
:
specific
_runner
)
do
create
(
:ci_runner
).
tap
do
|
runner
|
create
(
:ci_runner_project
,
runner:
runner
,
project:
project
)
end
...
...
@@ -57,17 +51,9 @@ describe API::V3::Runners do
end
.
to
change
{
Ci
::
Runner
.
specific
.
count
}.
by
(
-
1
)
end
it
'deletes used
project
runner'
do
it
'deletes used runner'
do
expect
do
delete
v3_api
(
"/runners/
#{
project_runner
.
id
}
"
,
admin
)
expect
(
response
).
to
have_http_status
(
200
)
end
.
to
change
{
Ci
::
Runner
.
specific
.
count
}.
by
(
-
1
)
end
it
'deletes used group runner'
do
expect
do
delete
v3_api
(
"/runners/
#{
group_runner
.
id
}
"
,
admin
)
delete
v3_api
(
"/runners/
#{
specific_runner
.
id
}
"
,
admin
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
end
.
to
change
{
Ci
::
Runner
.
specific
.
count
}.
by
(
-
1
)
...
...
@@ -91,31 +77,18 @@ describe API::V3::Runners do
context
'when runner is not shared'
do
it
'does not delete runner without access to it'
do
delete
v3_api
(
"/runners/
#{
project
_runner
.
id
}
"
,
user2
)
delete
v3_api
(
"/runners/
#{
specific
_runner
.
id
}
"
,
user2
)
expect
(
response
).
to
have_gitlab_http_status
(
403
)
end
it
'does not delete
project
runner with more than one associated project'
do
it
'does not delete runner with more than one associated project'
do
delete
v3_api
(
"/runners/
#{
two_projects_runner
.
id
}
"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
403
)
end
it
'deletes
project
runner for one owned project'
do
it
'deletes runner for one owned project'
do
expect
do
delete
v3_api
(
"/runners/
#{
group_runner
.
id
}
"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
end
.
to
change
{
Ci
::
Runner
.
specific
.
count
}.
by
(
-
1
)
end
it
'does not delete group runner with more than one associated project'
do
delete
v3_api
(
"/runners/
#{
two_groups_runner
.
id
}
"
,
user
)
expect
(
response
).
to
have_http_status
(
403
)
end
it
'deletes group runner for one owned project'
do
expect
do
delete
v3_api
(
"/runners/
#{
project_runner
.
id
}
"
,
user
)
delete
v3_api
(
"/runners/
#{
specific_runner
.
id
}
"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
end
.
to
change
{
Ci
::
Runner
.
specific
.
count
}.
by
(
-
1
)
...
...
@@ -124,14 +97,8 @@ describe API::V3::Runners do
end
context
'unauthorized user'
do
it
'does not delete project runner'
do
delete
v3_api
(
"/runners/
#{
project_runner
.
id
}
"
)
expect
(
response
).
to
have_http_status
(
401
)
end
it
'does not delete group runner'
do
delete
v3_api
(
"/runners/
#{
group_runner
.
id
}
"
)
it
'does not delete runner'
do
delete
v3_api
(
"/runners/
#{
specific_runner
.
id
}
"
)
expect
(
response
).
to
have_gitlab_http_status
(
401
)
end
...
...
@@ -153,7 +120,7 @@ describe API::V3::Runners do
context
'when runner have one associated projects'
do
it
"does not disable project's runner"
do
expect
do
delete
v3_api
(
"/projects/
#{
project
.
id
}
/runners/
#{
project
_runner
.
id
}
"
,
user
)
delete
v3_api
(
"/projects/
#{
project
.
id
}
/runners/
#{
specific
_runner
.
id
}
"
,
user
)
end
.
to
change
{
project
.
runners
.
count
}.
by
(
0
)
expect
(
response
).
to
have_gitlab_http_status
(
403
)
end
...
...
@@ -168,7 +135,7 @@ describe API::V3::Runners do
context
'authorized user without permissions'
do
it
"does not disable project's runner"
do
delete
v3_api
(
"/projects/
#{
project
.
id
}
/runners/
#{
project
_runner
.
id
}
"
,
user2
)
delete
v3_api
(
"/projects/
#{
project
.
id
}
/runners/
#{
specific
_runner
.
id
}
"
,
user2
)
expect
(
response
).
to
have_gitlab_http_status
(
403
)
end
...
...
@@ -176,7 +143,7 @@ describe API::V3::Runners do
context
'unauthorized user'
do
it
"does not disable project's runner"
do
delete
v3_api
(
"/projects/
#{
project
.
id
}
/runners/
#{
project
_runner
.
id
}
"
)
delete
v3_api
(
"/projects/
#{
project
.
id
}
/runners/
#{
specific
_runner
.
id
}
"
)
expect
(
response
).
to
have_gitlab_http_status
(
401
)
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