diff options
author | KN4CK3R <admin@oldschoolhack.me> | 2022-08-09 15:47:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-09 16:47:57 +0300 |
commit | 920481340b3d3c384c16296be52ca187ee8b0e0b (patch) | |
tree | 682a194a04c42275fd71f7ff6251c6eaac4f520f /integrations | |
parent | 1b2cd4c4e19c78390be329b4a3ad50ff8857ca8d (diff) | |
download | gitea-920481340b3d3c384c16296be52ca187ee8b0e0b.tar.gz gitea-920481340b3d3c384c16296be52ca187ee8b0e0b.zip |
Keep download count on Container tag overwrite (#20728)
Co-authored-by: 6543 <6543@obermui.de>
Diffstat (limited to 'integrations')
-rw-r--r-- | integrations/api_packages_container_test.go | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/integrations/api_packages_container_test.go b/integrations/api_packages_container_test.go index 5e073f313f..1c4f9e7475 100644 --- a/integrations/api_packages_container_test.go +++ b/integrations/api_packages_container_test.go @@ -276,11 +276,23 @@ func TestPackageContainer(t *testing.T) { } } - // Overwrite existing tag + req = NewRequest(t, "GET", fmt.Sprintf("%s/manifests/%s", url, tag)) + addTokenAuthHeader(req, userToken) + MakeRequest(t, req, http.StatusOK) + + pv, err = packages_model.GetVersionByNameAndVersion(db.DefaultContext, user.ID, packages_model.TypeContainer, image, tag) + assert.NoError(t, err) + assert.EqualValues(t, 1, pv.DownloadCount) + + // Overwrite existing tag should keep the download count req = NewRequestWithBody(t, "PUT", fmt.Sprintf("%s/manifests/%s", url, tag), strings.NewReader(manifestContent)) addTokenAuthHeader(req, userToken) req.Header.Set("Content-Type", oci.MediaTypeDockerManifest) MakeRequest(t, req, http.StatusCreated) + + pv, err = packages_model.GetVersionByNameAndVersion(db.DefaultContext, user.ID, packages_model.TypeContainer, image, tag) + assert.NoError(t, err) + assert.EqualValues(t, 1, pv.DownloadCount) }) t.Run("HeadManifest", func(t *testing.T) { |