Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
a743b1c7
Commit
a743b1c7
authored
Feb 22, 2022
by
Siddharth Asthana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify third party container repository delete tags services
Changelog: other
parent
c26b14ae
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
2 deletions
+14
-2
app/services/projects/container_repository/third_party/delete_tags_service.rb
...s/container_repository/third_party/delete_tags_service.rb
+1
-1
spec/services/projects/container_repository/third_party/delete_tags_service_spec.rb
...tainer_repository/third_party/delete_tags_service_spec.rb
+13
-1
No files found.
app/services/projects/container_repository/third_party/delete_tags_service.rb
View file @
a743b1c7
...
...
@@ -33,7 +33,7 @@ module Projects
if
deleted_tags
.
any?
&&
@container_repository
.
delete_tag_by_digest
(
deleted_tags
.
each_value
.
first
)
success
(
deleted:
deleted_tags
.
keys
)
else
error
(
'could not delete tags'
)
error
(
"could not delete tags:
#{
@tag_names
.
join
(
', '
)
}
"
.
truncate
(
1000
)
)
end
end
...
...
spec/services/projects/container_repository/third_party/delete_tags_service_spec.rb
View file @
a743b1c7
...
...
@@ -58,7 +58,19 @@ RSpec.describe Projects::ContainerRepository::ThirdParty::DeleteTagsService do
stub_put_manifest_request
(
'Ba'
,
500
,
{})
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
context
'a single tag update fails'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment