Commit a743b1c7 authored by Siddharth Asthana's avatar Siddharth Asthana

Simplify third party container repository delete tags services

Changelog: other
parent c26b14ae
...@@ -33,7 +33,7 @@ module Projects ...@@ -33,7 +33,7 @@ module Projects
if deleted_tags.any? && @container_repository.delete_tag_by_digest(deleted_tags.each_value.first) if deleted_tags.any? && @container_repository.delete_tag_by_digest(deleted_tags.each_value.first)
success(deleted: deleted_tags.keys) success(deleted: deleted_tags.keys)
else else
error('could not delete tags') error("could not delete tags: #{@tag_names.join(', ')}".truncate(1000))
end end
end end
......
...@@ -58,7 +58,19 @@ RSpec.describe Projects::ContainerRepository::ThirdParty::DeleteTagsService do ...@@ -58,7 +58,19 @@ RSpec.describe Projects::ContainerRepository::ThirdParty::DeleteTagsService do
stub_put_manifest_request('Ba', 500, {}) stub_put_manifest_request('Ba', 500, {})
end end
it { is_expected.to eq(status: :error, message: 'could not delete tags') } it { is_expected.to eq(status: :error, message: "could not delete tags: #{tags.join(', ')}")}
context 'when a large list of tag updates fails' do
let(:tags) { Array.new(1000) { |i| "tag_#{i}" } }
before do
expect(service).to receive(:replace_tag_manifests).and_return({})
end
it 'truncates the log message' do
expect(subject).to eq(status: :error, message: "could not delete tags: #{tags.join(', ')}".truncate(1000))
end
end
end end
context 'a single tag update fails' do context 'a single tag update fails' do
......
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