summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2017-02-27 14:35:21 +0000
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2017-02-27 14:35:21 +0000
commit1229ce06bd49dcd98b2df4d3358034021b74e0d3 (patch)
tree0338da444d52331b06a293549199f09cad5d5eb9
parentdfd15596a4b53ba2b7b3d0be9d5c17e2d7824c8f (diff)
parent334591dd766ca31ab087475bfefbb5eb9dd1a0cf (diff)
downloadgitlab-ce-1229ce06bd49dcd98b2df4d3358034021b74e0d3.tar.gz
Merge branch 'sh-async-delete-children' into 'master'
Make nested groups deletion synchronous to avoid potential race See merge request !9288
-rw-r--r--app/services/groups/destroy_service.rb3
-rw-r--r--spec/services/groups/destroy_service_spec.rb2
2 files changed, 4 insertions, 1 deletions
diff --git a/app/services/groups/destroy_service.rb b/app/services/groups/destroy_service.rb
index 2e2d7f884ac..497fdb09cdc 100644
--- a/app/services/groups/destroy_service.rb
+++ b/app/services/groups/destroy_service.rb
@@ -18,7 +18,8 @@ module Groups
end
group.children.each do |group|
- DestroyService.new(group, current_user).async_execute
+ # This needs to be synchronous since the namespace gets destroyed below
+ DestroyService.new(group, current_user).execute
end
group.really_destroy!
diff --git a/spec/services/groups/destroy_service_spec.rb b/spec/services/groups/destroy_service_spec.rb
index 32c2ed8cae7..98c560ffb26 100644
--- a/spec/services/groups/destroy_service_spec.rb
+++ b/spec/services/groups/destroy_service_spec.rb
@@ -5,6 +5,7 @@ describe Groups::DestroyService, services: true do
let!(:user) { create(:user) }
let!(:group) { create(:group) }
+ let!(:nested_group) { create(:group, parent: group) }
let!(:project) { create(:project, namespace: group) }
let!(:gitlab_shell) { Gitlab::Shell.new }
let!(:remove_path) { group.path + "+#{group.id}+deleted" }
@@ -20,6 +21,7 @@ describe Groups::DestroyService, services: true do
end
it { expect(Group.unscoped.all).not_to include(group) }
+ it { expect(Group.unscoped.all).not_to include(nested_group) }
it { expect(Project.unscoped.all).not_to include(project) }
end