summaryrefslogtreecommitdiff
path: root/spec/controllers
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-09-05 23:33:30 -0700
committerStan Hu <stanhu@gmail.com>2018-09-07 12:42:59 -0700
commit5830d1143dbf6b2958153233279896961e9a44df (patch)
treec3828d2fb9a5fbd2edc1c0c4a74537c6efe95d8c /spec/controllers
parent272281e4729c9e2193acea84394a191cfe2496af (diff)
downloadgitlab-ce-5830d1143dbf6b2958153233279896961e9a44df.tar.gz
Delete a container registry asynchronously
When a container registry has many tags, it's easy for the DELETE call to take more than 60 seconds and fail. This can also leave the registry in a bad state with null bytes since some of the images have been deleted with tags still pointing to them. In addition, we have to prevent users from accidentally initiating the delete multiple times or this could leave the registry with orphaned tags. This commit also adds a flash message to notify the user the registry is scheduled for deletion. Closes #49926, #51063
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/projects/registry/repositories_controller_spec.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/spec/controllers/projects/registry/repositories_controller_spec.rb b/spec/controllers/projects/registry/repositories_controller_spec.rb
index 17769a14def..d11e42b411b 100644
--- a/spec/controllers/projects/registry/repositories_controller_spec.rb
+++ b/spec/controllers/projects/registry/repositories_controller_spec.rb
@@ -86,9 +86,10 @@ describe Projects::Registry::RepositoriesController do
stub_container_registry_tags(repository: :any, tags: [])
end
- it 'deletes a repository' do
- expect { delete_repository(repository) }.to change { ContainerRepository.all.count }.by(-1)
+ it 'schedules a job to delete a repository' do
+ expect(DeleteContainerRepositoryWorker).to receive(:perform_async).with(user.id, repository.id)
+ delete_repository(repository)
expect(response).to have_gitlab_http_status(:no_content)
end
end