mirror of
https://github.com/distribution/distribution.git
synced 2025-09-16 07:09:49 +00:00
Add tests for tags list pagination
Signed-off-by: João Pereira <484633+joaodrp@users.noreply.github.com>
This commit is contained in:
@@ -128,7 +128,7 @@ func (ub *URLBuilder) BuildCatalogURL(values ...url.Values) (string, error) {
|
||||
}
|
||||
|
||||
// BuildTagsURL constructs a url to list the tags in the named repository.
|
||||
func (ub *URLBuilder) BuildTagsURL(name reference.Named) (string, error) {
|
||||
func (ub *URLBuilder) BuildTagsURL(name reference.Named, values ...url.Values) (string, error) {
|
||||
route := ub.cloneRoute(RouteNameTags)
|
||||
|
||||
tagsURL, err := route.URL("name", name.Name())
|
||||
@@ -136,7 +136,7 @@ func (ub *URLBuilder) BuildTagsURL(name reference.Named) (string, error) {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return tagsURL.String(), nil
|
||||
return appendValuesURL(tagsURL, values...).String(), nil
|
||||
}
|
||||
|
||||
// BuildManifestURL constructs a url for the manifest identified by name and
|
||||
|
@@ -34,6 +34,26 @@ func makeURLBuilderTestCases(urlBuilder *URLBuilder) []urlBuilderTestCase {
|
||||
return urlBuilder.BuildTagsURL(fooBarRef)
|
||||
},
|
||||
},
|
||||
{
|
||||
description: "test tags url with n query parameter",
|
||||
expectedPath: "/v2/foo/bar/tags/list?n=10",
|
||||
expectedErr: nil,
|
||||
build: func() (string, error) {
|
||||
return urlBuilder.BuildTagsURL(fooBarRef, url.Values{
|
||||
"n": []string{"10"},
|
||||
})
|
||||
},
|
||||
},
|
||||
{
|
||||
description: "test tags url with last query parameter",
|
||||
expectedPath: "/v2/foo/bar/tags/list?last=abc-def",
|
||||
expectedErr: nil,
|
||||
build: func() (string, error) {
|
||||
return urlBuilder.BuildTagsURL(fooBarRef, url.Values{
|
||||
"last": []string{"abc-def"},
|
||||
})
|
||||
},
|
||||
},
|
||||
{
|
||||
description: "test manifest url tagged ref",
|
||||
expectedPath: "/v2/foo/bar/manifests/tag",
|
||||
|
Reference in New Issue
Block a user