Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-09-14 08:02:04 +0300
committerStan Hu <stanhu@gmail.com>2018-09-19 15:03:18 +0300
commita1912ccc894386b112faba2932f1dd98c03aea0e (patch)
tree82eee97163f1802be69cd5810fe04bec96ae2689 /spec
parentc6660e61b267dafe7e4f6ce2b4e38b644e7b2177 (diff)
Delete container repository tags outside of transaction
When there are many tags in a container repository, deleting them can exceed the default 60 second idle-in-transaction timeout in Sidekiq. We now explicitly delete them in the DestroyService before destroying the model. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/51380
Diffstat (limited to 'spec')
-rw-r--r--spec/features/container_registry_spec.rb2
-rw-r--r--spec/services/projects/container_repository/destroy_service_spec.rb1
2 files changed, 2 insertions, 1 deletions
diff --git a/spec/features/container_registry_spec.rb b/spec/features/container_registry_spec.rb
index 9986206f619..0dddf6d3ec5 100644
--- a/spec/features/container_registry_spec.rb
+++ b/spec/features/container_registry_spec.rb
@@ -39,7 +39,7 @@ describe "Container Registry", :js do
visit_container_registry
expect_any_instance_of(ContainerRepository)
- .to receive(:delete_tags!).and_return(true)
+ .to receive(:delete_tags!).twice.and_return(true)
click_on(class: 'js-remove-repo')
end
diff --git a/spec/services/projects/container_repository/destroy_service_spec.rb b/spec/services/projects/container_repository/destroy_service_spec.rb
index 307ccc88865..af54e1b15e3 100644
--- a/spec/services/projects/container_repository/destroy_service_spec.rb
+++ b/spec/services/projects/container_repository/destroy_service_spec.rb
@@ -33,6 +33,7 @@ describe Projects::ContainerRepository::DestroyService do
end
it 'deletes the repository' do
+ expect(repository).to receive(:delete_tags!).twice.and_call_original
expect { described_class.new(project, user).execute(repository) }.to change { ContainerRepository.all.count }.by(-1)
end
end