mirror of
https://github.com/project-zot/zot.git
synced 2026-06-17 04:48:26 +08:00
fix(storage): do not open/download blobs when validating manifests (#1566)
when pushing manifests, zot will validate blobs (layers + config blob) are present in repo, currently it opens(in case of filesystem storage) or download( in case of cloud storage) each blob. fixed that by adding a new method ImageStore.CheckBlobPresence() on storage to check blobs presence without checking the cache like ImageStore.CheckBlob() method does. Signed-off-by: Petu Eusebiu <peusebiu@cisco.com>
This commit is contained in:
@@ -259,6 +259,10 @@ func TestStorageAPIs(t *testing.T) {
|
||||
_, _, err = imgStore.CheckBlob("test", digest)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
ok, _, err := imgStore.StatBlob("test", digest)
|
||||
So(ok, ShouldBeTrue)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
blob, _, err := imgStore.GetBlob("test", digest, "application/vnd.oci.image.layer.v1.tar+gzip")
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
@@ -401,6 +405,10 @@ func TestStorageAPIs(t *testing.T) {
|
||||
So(err, ShouldNotBeNil)
|
||||
So(hasBlob, ShouldEqual, false)
|
||||
|
||||
hasBlob, _, err = imgStore.StatBlob("test", digest)
|
||||
So(err, ShouldNotBeNil)
|
||||
So(hasBlob, ShouldEqual, false)
|
||||
|
||||
err = imgStore.DeleteBlob("test", "inexistent")
|
||||
So(err, ShouldNotBeNil)
|
||||
|
||||
@@ -457,7 +465,12 @@ func TestStorageAPIs(t *testing.T) {
|
||||
err = imgStore.FinishBlobUpload("test", bupload, buf, digest)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
_, _, err = imgStore.CheckBlob("test", digest)
|
||||
ok, _, err := imgStore.CheckBlob("test", digest)
|
||||
So(ok, ShouldBeTrue)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
ok, _, err = imgStore.StatBlob("test", digest)
|
||||
So(ok, ShouldBeTrue)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
_, _, err = imgStore.GetBlob("test", "inexistent", "application/vnd.oci.image.layer.v1.tar+gzip")
|
||||
@@ -486,6 +499,9 @@ func TestStorageAPIs(t *testing.T) {
|
||||
|
||||
_, _, err = imgStore.CheckBlob("test", "inexistent")
|
||||
So(err, ShouldNotBeNil)
|
||||
|
||||
_, _, err = imgStore.StatBlob("test", "inexistent")
|
||||
So(err, ShouldNotBeNil)
|
||||
})
|
||||
|
||||
Convey("Bad image manifest", func() {
|
||||
|
||||
Reference in New Issue
Block a user