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
304d6a90
Commit
304d6a90
authored
May 18, 2018
by
Stan Hu
Committed by
Robert Speicher
May 18, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move API group deletion to Sidekiq
parent
3adb5bb4
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
10 deletions
+25
-10
changelogs/unreleased/sh-move-delete-groups-api-async.yml
changelogs/unreleased/sh-move-delete-groups-api-async.yml
+5
-0
doc/api/groups.md
doc/api/groups.md
+3
-0
lib/api/groups.rb
lib/api/groups.rb
+3
-2
lib/api/v3/groups.rb
lib/api/v3/groups.rb
+3
-2
spec/requests/api/groups_spec.rb
spec/requests/api/groups_spec.rb
+6
-3
spec/requests/api/v3/groups_spec.rb
spec/requests/api/v3/groups_spec.rb
+5
-3
No files found.
changelogs/unreleased/sh-move-delete-groups-api-async.yml
0 → 100644
View file @
304d6a90
---
title
:
Move API group deletion to Sidekiq
merge_request
:
author
:
type
:
changed
doc/api/groups.md
View file @
304d6a90
...
...
@@ -492,6 +492,9 @@ Parameters:
-
`id`
(required) - The ID or path of a user group
This will queue a background job to delete all projects in the group. The
response will be a 202 Accepted if the user has authorization.
## Search for group
Get all groups that match your string in their name or path.
...
...
lib/api/groups.rb
View file @
304d6a90
...
...
@@ -203,9 +203,10 @@ module API
Gitlab
::
QueryLimiting
.
whitelist
(
'https://gitlab.com/gitlab-org/gitlab-ce/issues/46285'
)
destroy_conditionally!
(
group
)
do
|
group
|
::
Groups
::
DestroyService
.
new
(
group
,
current_user
).
execute
::
Groups
::
DestroyService
.
new
(
group
,
current_user
).
async_
execute
end
status
204
accepted!
end
desc
'Get a list of projects in this group.'
do
...
...
lib/api/v3/groups.rb
View file @
304d6a90
...
...
@@ -155,8 +155,9 @@ module API
group
=
find_group!
(
params
[
:id
])
authorize!
:admin_group
,
group
Gitlab
::
QueryLimiting
.
whitelist
(
'https://gitlab.com/gitlab-org/gitlab-ce/issues/46285'
)
present
::
Groups
::
DestroyService
.
new
(
group
,
current_user
).
execute
,
with:
Entities
::
GroupDetail
,
current_user:
current_user
::
Groups
::
DestroyService
.
new
(
group
,
current_user
).
async_execute
accepted!
end
desc
'Get a list of projects in this group.'
do
...
...
spec/requests/api/groups_spec.rb
View file @
304d6a90
...
...
@@ -818,13 +818,16 @@ describe API::Groups do
describe
"DELETE /groups/:id"
do
context
"when authenticated as user"
do
it
"removes group"
do
delete
api
(
"/groups/
#{
group1
.
id
}
"
,
user1
)
Sidekiq
::
Testing
.
fake!
do
expect
{
delete
api
(
"/groups/
#{
group1
.
id
}
"
,
user1
)
}.
to
change
(
GroupDestroyWorker
.
jobs
,
:size
).
by
(
1
)
end
expect
(
response
).
to
have_gitlab_http_status
(
20
4
)
expect
(
response
).
to
have_gitlab_http_status
(
20
2
)
end
it_behaves_like
'412 response'
do
let
(
:request
)
{
api
(
"/groups/
#{
group1
.
id
}
"
,
user1
)
}
let
(
:success_status
)
{
202
}
end
it
"does not remove a group if not an owner"
do
...
...
@@ -853,7 +856,7 @@ describe API::Groups do
it
"removes any existing group"
do
delete
api
(
"/groups/
#{
group2
.
id
}
"
,
admin
)
expect
(
response
).
to
have_gitlab_http_status
(
20
4
)
expect
(
response
).
to
have_gitlab_http_status
(
20
2
)
end
it
"does not remove a non existing group"
do
...
...
spec/requests/api/v3/groups_spec.rb
View file @
304d6a90
...
...
@@ -607,9 +607,11 @@ describe API::V3::Groups do
describe
"DELETE /groups/:id"
do
context
"when authenticated as user"
do
it
"removes group"
do
delete
v3_api
(
"/groups/
#{
group1
.
id
}
"
,
user1
)
Sidekiq
::
Testing
.
fake!
do
expect
{
delete
v3_api
(
"/groups/
#{
group1
.
id
}
"
,
user1
)
}.
to
change
(
GroupDestroyWorker
.
jobs
,
:size
).
by
(
1
)
end
expect
(
response
).
to
have_gitlab_http_status
(
20
0
)
expect
(
response
).
to
have_gitlab_http_status
(
20
2
)
end
it
"does not remove a group if not an owner"
do
...
...
@@ -638,7 +640,7 @@ describe API::V3::Groups do
it
"removes any existing group"
do
delete
v3_api
(
"/groups/
#{
group2
.
id
}
"
,
admin
)
expect
(
response
).
to
have_gitlab_http_status
(
20
0
)
expect
(
response
).
to
have_gitlab_http_status
(
20
2
)
end
it
"does not remove a non existing group"
do
...
...
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