Commit b6002ed4 authored by Nick Thomas's avatar Nick Thomas
Browse files

Merge branch '49796-project-deletion-may-not-log-audit-events-during-group-deletion' into 'master'

Resolve "Project deletion may not log audit events during group deletion"

Closes #49796

See merge request gitlab-org/gitlab-ce!21162
......@@ -2,6 +2,8 @@
module Groups
class DestroyService < Groups::BaseService
DestroyError =
def async_execute
job_id = GroupDestroyWorker.perform_async(,"User #{} scheduled a deletion of group ID #{} with job ID #{job_id}")
......@@ -12,9 +14,8 @@ def execute
group.projects.each do |project|
# Execute the destruction of the models immediately to ensure atomic cleanup.
# Skip repository removal because we remove directory with namespace
# that contain all these repositories, current_user, skip_repo: project.legacy_storage?).execute
success =, current_user).execute
raise DestroyError, "Project #{} can't be deleted" unless success
group.children.each do |group|
title: 'Fix: Project deletion may not log audit events during group deletion'
merge_request: 21162
type: fixed
......@@ -135,6 +135,17 @@ def destroy_group(group, user, async)
it_behaves_like 'group destruction', false
context 'repository removal status is taken into account' do
it 'raises exception' do
expect_next_instance_of(::Projects::DestroyService) do |destroy_service|
expect(destroy_service).to receive(:execute).and_return(false)
expect { destroy_group(group, user, false) }
.to raise_error(Groups::DestroyService::DestroyError, "Project #{} can't be deleted" )
describe 'repository removal' do
before do
destroy_group(group, user, false)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment