gc: fix test cases since umoci GC is more strict

umoci GC enforces a valid index.json and current tests were a little
lax.
This commit is contained in:
Ramkumar Chinchani
2020-03-18 15:42:06 -07:00
parent 4774aa81b3
commit fe471a3c35
5 changed files with 67 additions and 6 deletions
+6 -1
View File
@@ -15,9 +15,9 @@ import (
"github.com/anuvu/zot/errors"
zlog "github.com/anuvu/zot/pkg/log"
guuid "github.com/gofrs/uuid"
"github.com/openSUSE/umoci"
godigest "github.com/opencontainers/go-digest"
ispec "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/openSUSE/umoci"
"github.com/rs/zerolog"
)
@@ -335,6 +335,11 @@ func (is *ImageStore) PutImageManifest(repo string, reference string, mediaType
return "", errors.ErrBadManifest
}
if m.SchemaVersion != 2 {
is.log.Error().Int("SchemaVersion", m.SchemaVersion).Msg("invalid manifest")
return "", errors.ErrBadManifest
}
for _, l := range m.Layers {
digest := l.Digest
blobPath := is.BlobPath(repo, digest)