mirror of
https://github.com/project-zot/zot.git
synced 2026-06-16 20:38:08 +08:00
refactor: remove pkg/extensions/search/common and move the code to the appropriate packages (#1358)
Signed-off-by: Nicol Draghici <idraghic@cisco.com>
This commit is contained in:
@@ -1,14 +1,13 @@
|
||||
package mocks
|
||||
|
||||
import (
|
||||
"zotregistry.io/zot/pkg/extensions/search/common"
|
||||
cveinfo "zotregistry.io/zot/pkg/extensions/search/cve"
|
||||
cvemodel "zotregistry.io/zot/pkg/extensions/search/cve/model"
|
||||
)
|
||||
|
||||
type CveInfoMock struct {
|
||||
GetImageListForCVEFn func(repo, cveID string) ([]common.TagInfo, error)
|
||||
GetImageListWithCVEFixedFn func(repo, cveID string) ([]common.TagInfo, error)
|
||||
GetImageListForCVEFn func(repo, cveID string) ([]cvemodel.TagInfo, error)
|
||||
GetImageListWithCVEFixedFn func(repo, cveID string) ([]cvemodel.TagInfo, error)
|
||||
GetCVEListForImageFn func(repo string, reference string, searchedCVE string, pageInput cveinfo.PageInput,
|
||||
) ([]cvemodel.CVE, cveinfo.PageInfo, error)
|
||||
GetCVESummaryForImageFn func(repo string, reference string,
|
||||
@@ -17,20 +16,20 @@ type CveInfoMock struct {
|
||||
UpdateDBFn func() error
|
||||
}
|
||||
|
||||
func (cveInfo CveInfoMock) GetImageListForCVE(repo, cveID string) ([]common.TagInfo, error) {
|
||||
func (cveInfo CveInfoMock) GetImageListForCVE(repo, cveID string) ([]cvemodel.TagInfo, error) {
|
||||
if cveInfo.GetImageListForCVEFn != nil {
|
||||
return cveInfo.GetImageListForCVEFn(repo, cveID)
|
||||
}
|
||||
|
||||
return []common.TagInfo{}, nil
|
||||
return []cvemodel.TagInfo{}, nil
|
||||
}
|
||||
|
||||
func (cveInfo CveInfoMock) GetImageListWithCVEFixed(repo, cveID string) ([]common.TagInfo, error) {
|
||||
func (cveInfo CveInfoMock) GetImageListWithCVEFixed(repo, cveID string) ([]cvemodel.TagInfo, error) {
|
||||
if cveInfo.GetImageListWithCVEFixedFn != nil {
|
||||
return cveInfo.GetImageListWithCVEFixedFn(repo, cveID)
|
||||
}
|
||||
|
||||
return []common.TagInfo{}, nil
|
||||
return []cvemodel.TagInfo{}, nil
|
||||
}
|
||||
|
||||
func (cveInfo CveInfoMock) GetCVEListForImage(repo string, reference string,
|
||||
|
||||
@@ -4,7 +4,8 @@ import (
|
||||
godigest "github.com/opencontainers/go-digest"
|
||||
ispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
|
||||
"zotregistry.io/zot/pkg/extensions/search/common"
|
||||
"zotregistry.io/zot/pkg/common"
|
||||
cvemodel "zotregistry.io/zot/pkg/extensions/search/cve/model"
|
||||
)
|
||||
|
||||
type OciLayoutUtilsMock struct {
|
||||
@@ -12,11 +13,11 @@ type OciLayoutUtilsMock struct {
|
||||
GetImageManifestsFn func(repo string) ([]ispec.Descriptor, error)
|
||||
GetImageBlobManifestFn func(repo string, digest godigest.Digest) (ispec.Manifest, error)
|
||||
GetImageInfoFn func(repo string, digest godigest.Digest) (ispec.Image, error)
|
||||
GetImageTagsWithTimestampFn func(repo string) ([]common.TagInfo, error)
|
||||
GetImageTagsWithTimestampFn func(repo string) ([]cvemodel.TagInfo, error)
|
||||
GetImagePlatformFn func(imageInfo ispec.Image) (string, string)
|
||||
GetImageManifestSizeFn func(repo string, manifestDigest godigest.Digest) int64
|
||||
GetImageConfigSizeFn func(repo string, manifestDigest godigest.Digest) int64
|
||||
GetRepoLastUpdatedFn func(repo string) (common.TagInfo, error)
|
||||
GetRepoLastUpdatedFn func(repo string) (cvemodel.TagInfo, error)
|
||||
GetExpandedRepoInfoFn func(name string) (common.RepoInfo, error)
|
||||
GetImageConfigInfoFn func(repo string, manifestDigest godigest.Digest) (ispec.Image, error)
|
||||
CheckManifestSignatureFn func(name string, digest godigest.Digest) bool
|
||||
@@ -64,12 +65,12 @@ func (olum OciLayoutUtilsMock) GetImageInfo(repo string, digest godigest.Digest)
|
||||
return ispec.Image{}, nil
|
||||
}
|
||||
|
||||
func (olum OciLayoutUtilsMock) GetImageTagsWithTimestamp(repo string) ([]common.TagInfo, error) {
|
||||
func (olum OciLayoutUtilsMock) GetImageTagsWithTimestamp(repo string) ([]cvemodel.TagInfo, error) {
|
||||
if olum.GetImageTagsWithTimestampFn != nil {
|
||||
return olum.GetImageTagsWithTimestampFn(repo)
|
||||
}
|
||||
|
||||
return []common.TagInfo{}, nil
|
||||
return []cvemodel.TagInfo{}, nil
|
||||
}
|
||||
|
||||
func (olum OciLayoutUtilsMock) GetImagePlatform(imageInfo ispec.Image) (string, string) {
|
||||
@@ -96,12 +97,12 @@ func (olum OciLayoutUtilsMock) GetImageConfigSize(repo string, manifestDigest go
|
||||
return 0
|
||||
}
|
||||
|
||||
func (olum OciLayoutUtilsMock) GetRepoLastUpdated(repo string) (common.TagInfo, error) {
|
||||
func (olum OciLayoutUtilsMock) GetRepoLastUpdated(repo string) (cvemodel.TagInfo, error) {
|
||||
if olum.GetRepoLastUpdatedFn != nil {
|
||||
return olum.GetRepoLastUpdatedFn(repo)
|
||||
}
|
||||
|
||||
return common.TagInfo{}, nil
|
||||
return cvemodel.TagInfo{}, nil
|
||||
}
|
||||
|
||||
func (olum OciLayoutUtilsMock) GetExpandedRepoInfo(name string) (common.RepoInfo, error) {
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
//go:build sync && scrub && metrics && search
|
||||
// +build sync,scrub,metrics,search
|
||||
|
||||
package test
|
||||
package ocilayout
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
goerrors "errors"
|
||||
"fmt"
|
||||
"path"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -17,20 +18,22 @@ import (
|
||||
ispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
|
||||
zerr "zotregistry.io/zot/errors"
|
||||
"zotregistry.io/zot/pkg/extensions/search/common"
|
||||
"zotregistry.io/zot/pkg/common"
|
||||
"zotregistry.io/zot/pkg/extensions/search/convert"
|
||||
cvemodel "zotregistry.io/zot/pkg/extensions/search/cve/model"
|
||||
"zotregistry.io/zot/pkg/log"
|
||||
"zotregistry.io/zot/pkg/storage"
|
||||
)
|
||||
|
||||
type OciLayoutUtils interface { //nolint: interfacebloat
|
||||
type OciUtils interface { //nolint: interfacebloat
|
||||
GetImageManifest(repo string, reference string) (ispec.Manifest, godigest.Digest, error)
|
||||
GetImageManifests(repo string) ([]ispec.Descriptor, error)
|
||||
GetImageBlobManifest(repo string, digest godigest.Digest) (ispec.Manifest, error)
|
||||
GetImageInfo(repo string, configDigest godigest.Digest) (ispec.Image, error)
|
||||
GetImageTagsWithTimestamp(repo string) ([]common.TagInfo, error)
|
||||
GetImageTagsWithTimestamp(repo string) ([]cvemodel.TagInfo, error)
|
||||
GetImagePlatform(imageInfo ispec.Image) (string, string)
|
||||
GetImageManifestSize(repo string, manifestDigest godigest.Digest) int64
|
||||
GetRepoLastUpdated(repo string) (common.TagInfo, error)
|
||||
GetRepoLastUpdated(repo string) (cvemodel.TagInfo, error)
|
||||
GetExpandedRepoInfo(name string) (common.RepoInfo, error)
|
||||
GetImageConfigInfo(repo string, manifestDigest godigest.Digest) (ispec.Image, error)
|
||||
CheckManifestSignature(name string, digest godigest.Digest) bool
|
||||
@@ -180,8 +183,8 @@ func (olu BaseOciLayoutUtils) GetImageInfo(repo string, configDigest godigest.Di
|
||||
}
|
||||
|
||||
// GetImageTagsWithTimestamp returns a list of image tags with timestamp available in the specified repository.
|
||||
func (olu BaseOciLayoutUtils) GetImageTagsWithTimestamp(repo string) ([]common.TagInfo, error) {
|
||||
tagsInfo := make([]common.TagInfo, 0)
|
||||
func (olu BaseOciLayoutUtils) GetImageTagsWithTimestamp(repo string) ([]cvemodel.TagInfo, error) {
|
||||
tagsInfo := make([]cvemodel.TagInfo, 0)
|
||||
|
||||
manifests, err := olu.GetImageManifests(repo)
|
||||
if err != nil {
|
||||
@@ -212,10 +215,10 @@ func (olu BaseOciLayoutUtils) GetImageTagsWithTimestamp(repo string) ([]common.T
|
||||
timeStamp := common.GetImageLastUpdated(imageInfo)
|
||||
|
||||
tagsInfo = append(tagsInfo,
|
||||
common.TagInfo{
|
||||
cvemodel.TagInfo{
|
||||
Name: val,
|
||||
Timestamp: timeStamp,
|
||||
Descriptor: common.Descriptor{
|
||||
Descriptor: cvemodel.Descriptor{
|
||||
Digest: digest,
|
||||
MediaType: manifest.MediaType,
|
||||
},
|
||||
@@ -330,13 +333,13 @@ func (olu BaseOciLayoutUtils) GetImageConfigSize(repo string, manifestDigest god
|
||||
return imageBlobManifest.Config.Size
|
||||
}
|
||||
|
||||
func (olu BaseOciLayoutUtils) GetRepoLastUpdated(repo string) (common.TagInfo, error) {
|
||||
func (olu BaseOciLayoutUtils) GetRepoLastUpdated(repo string) (cvemodel.TagInfo, error) {
|
||||
tagsInfo, err := olu.GetImageTagsWithTimestamp(repo)
|
||||
if err != nil || len(tagsInfo) == 0 {
|
||||
return common.TagInfo{}, err
|
||||
return cvemodel.TagInfo{}, err
|
||||
}
|
||||
|
||||
latestTag := common.GetLatestTag(tagsInfo)
|
||||
latestTag := GetLatestTag(tagsInfo)
|
||||
|
||||
return latestTag, nil
|
||||
}
|
||||
@@ -433,7 +436,7 @@ func (olu BaseOciLayoutUtils) GetExpandedRepoInfo(repoName string) (common.RepoI
|
||||
imageSize := imageLayersSize + manifestSize + configSize
|
||||
|
||||
// get image info from manifest annotation, if not found get from image config labels.
|
||||
annotations := common.GetAnnotations(manifest.Annotations, imageConfigInfo.Config.Labels)
|
||||
annotations := convert.GetAnnotations(manifest.Annotations, imageConfigInfo.Config.Labels)
|
||||
|
||||
if annotations.Vendor != "" {
|
||||
repoVendorsSet[annotations.Vendor] = true
|
||||
@@ -579,3 +582,11 @@ func (olu BaseOciLayoutUtils) ExtractImageDetails(
|
||||
|
||||
return digest, &manifest, &imageConfig, nil
|
||||
}
|
||||
|
||||
func GetLatestTag(allTags []cvemodel.TagInfo) cvemodel.TagInfo {
|
||||
sort.Slice(allTags, func(i, j int) bool {
|
||||
return allTags[i].Timestamp.Before(allTags[j].Timestamp)
|
||||
})
|
||||
|
||||
return allTags[len(allTags)-1]
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
//go:build sync && scrub && metrics && search
|
||||
// +build sync,scrub,metrics,search
|
||||
|
||||
package test_test
|
||||
package ocilayout_test
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"os"
|
||||
"path"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
godigest "github.com/opencontainers/go-digest"
|
||||
ispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
@@ -19,13 +20,17 @@ import (
|
||||
"zotregistry.io/zot/pkg/api/config"
|
||||
extconf "zotregistry.io/zot/pkg/extensions/config"
|
||||
"zotregistry.io/zot/pkg/extensions/monitoring"
|
||||
cvemodel "zotregistry.io/zot/pkg/extensions/search/cve/model"
|
||||
"zotregistry.io/zot/pkg/log"
|
||||
"zotregistry.io/zot/pkg/storage"
|
||||
"zotregistry.io/zot/pkg/storage/local"
|
||||
. "zotregistry.io/zot/pkg/test"
|
||||
"zotregistry.io/zot/pkg/test/mocks"
|
||||
ocilayout "zotregistry.io/zot/pkg/test/oci-layout"
|
||||
)
|
||||
|
||||
var ErrTestError = fmt.Errorf("testError")
|
||||
|
||||
func TestBaseOciLayoutUtils(t *testing.T) {
|
||||
manifestDigest := GetTestBlobDigest("zot-test", "config").String()
|
||||
|
||||
@@ -37,7 +42,7 @@ func TestBaseOciLayoutUtils(t *testing.T) {
|
||||
}
|
||||
|
||||
storeController := storage.StoreController{DefaultStore: mockStoreController}
|
||||
olu := NewBaseOciLayoutUtils(storeController, log.NewLogger("debug", ""))
|
||||
olu := ocilayout.NewBaseOciLayoutUtils(storeController, log.NewLogger("debug", ""))
|
||||
|
||||
size := olu.GetImageManifestSize("", "")
|
||||
So(size, ShouldBeZeroValue)
|
||||
@@ -51,7 +56,7 @@ func TestBaseOciLayoutUtils(t *testing.T) {
|
||||
}
|
||||
|
||||
storeController := storage.StoreController{DefaultStore: mockStoreController}
|
||||
olu := NewBaseOciLayoutUtils(storeController, log.NewLogger("debug", ""))
|
||||
olu := ocilayout.NewBaseOciLayoutUtils(storeController, log.NewLogger("debug", ""))
|
||||
|
||||
size := olu.GetImageConfigSize("", "")
|
||||
So(size, ShouldBeZeroValue)
|
||||
@@ -86,7 +91,7 @@ func TestBaseOciLayoutUtils(t *testing.T) {
|
||||
}
|
||||
|
||||
storeController := storage.StoreController{DefaultStore: mockStoreController}
|
||||
olu := NewBaseOciLayoutUtils(storeController, log.NewLogger("debug", ""))
|
||||
olu := ocilayout.NewBaseOciLayoutUtils(storeController, log.NewLogger("debug", ""))
|
||||
|
||||
size := olu.GetImageConfigSize("", "")
|
||||
So(size, ShouldBeZeroValue)
|
||||
@@ -100,7 +105,7 @@ func TestBaseOciLayoutUtils(t *testing.T) {
|
||||
}
|
||||
|
||||
storeController := storage.StoreController{DefaultStore: mockStoreController}
|
||||
olu := NewBaseOciLayoutUtils(storeController, log.NewLogger("debug", ""))
|
||||
olu := ocilayout.NewBaseOciLayoutUtils(storeController, log.NewLogger("debug", ""))
|
||||
|
||||
_, err := olu.GetRepoLastUpdated("")
|
||||
So(err, ShouldNotBeNil)
|
||||
@@ -126,7 +131,7 @@ func TestBaseOciLayoutUtils(t *testing.T) {
|
||||
}
|
||||
|
||||
storeController := storage.StoreController{DefaultStore: mockStoreController}
|
||||
olu := NewBaseOciLayoutUtils(storeController, log.NewLogger("debug", ""))
|
||||
olu := ocilayout.NewBaseOciLayoutUtils(storeController, log.NewLogger("debug", ""))
|
||||
|
||||
_, err = olu.GetImageTagsWithTimestamp("rep")
|
||||
So(err, ShouldNotBeNil)
|
||||
@@ -170,7 +175,7 @@ func TestBaseOciLayoutUtils(t *testing.T) {
|
||||
}
|
||||
|
||||
storeController := storage.StoreController{DefaultStore: mockStoreController}
|
||||
olu := NewBaseOciLayoutUtils(storeController, log.NewLogger("debug", ""))
|
||||
olu := ocilayout.NewBaseOciLayoutUtils(storeController, log.NewLogger("debug", ""))
|
||||
|
||||
_, err = olu.GetImageTagsWithTimestamp("repo")
|
||||
So(err, ShouldNotBeNil)
|
||||
@@ -213,7 +218,7 @@ func TestBaseOciLayoutUtils(t *testing.T) {
|
||||
}
|
||||
|
||||
storeController := storage.StoreController{DefaultStore: mockStoreController}
|
||||
olu := NewBaseOciLayoutUtils(storeController, log.NewLogger("debug", ""))
|
||||
olu := ocilayout.NewBaseOciLayoutUtils(storeController, log.NewLogger("debug", ""))
|
||||
|
||||
_, err = olu.GetExpandedRepoInfo("rep")
|
||||
So(err, ShouldNotBeNil)
|
||||
@@ -226,7 +231,7 @@ func TestBaseOciLayoutUtils(t *testing.T) {
|
||||
}
|
||||
|
||||
storeController = storage.StoreController{DefaultStore: mockStoreController}
|
||||
olu = NewBaseOciLayoutUtils(storeController, log.NewLogger("debug", ""))
|
||||
olu = ocilayout.NewBaseOciLayoutUtils(storeController, log.NewLogger("debug", ""))
|
||||
|
||||
_, err = olu.GetExpandedRepoInfo("rep")
|
||||
So(err, ShouldNotBeNil)
|
||||
@@ -243,7 +248,7 @@ func TestBaseOciLayoutUtils(t *testing.T) {
|
||||
}
|
||||
|
||||
storeController = storage.StoreController{DefaultStore: mockStoreController}
|
||||
olu = NewBaseOciLayoutUtils(storeController, log.NewLogger("debug", ""))
|
||||
olu = ocilayout.NewBaseOciLayoutUtils(storeController, log.NewLogger("debug", ""))
|
||||
|
||||
_, err = olu.GetExpandedRepoInfo("rep")
|
||||
So(err, ShouldBeNil)
|
||||
@@ -257,7 +262,7 @@ func TestBaseOciLayoutUtils(t *testing.T) {
|
||||
}
|
||||
|
||||
storeController := storage.StoreController{DefaultStore: mockStoreController}
|
||||
olu := NewBaseOciLayoutUtils(storeController, log.NewLogger("debug", ""))
|
||||
olu := ocilayout.NewBaseOciLayoutUtils(storeController, log.NewLogger("debug", ""))
|
||||
|
||||
_, err := olu.GetImageInfo("", "")
|
||||
So(err, ShouldNotBeNil)
|
||||
@@ -275,7 +280,7 @@ func TestBaseOciLayoutUtils(t *testing.T) {
|
||||
}
|
||||
|
||||
storeController := storage.StoreController{DefaultStore: mockStoreController}
|
||||
olu := NewBaseOciLayoutUtils(storeController, log.NewLogger("debug", ""))
|
||||
olu := ocilayout.NewBaseOciLayoutUtils(storeController, log.NewLogger("debug", ""))
|
||||
|
||||
check := olu.CheckManifestSignature("rep", godigest.FromString(""))
|
||||
So(check, ShouldBeFalse)
|
||||
@@ -324,7 +329,7 @@ func TestBaseOciLayoutUtils(t *testing.T) {
|
||||
)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
olu = NewBaseOciLayoutUtils(ctlr.StoreController, log.NewLogger("debug", ""))
|
||||
olu = ocilayout.NewBaseOciLayoutUtils(ctlr.StoreController, log.NewLogger("debug", ""))
|
||||
manifestList, err := olu.GetImageManifests(repo)
|
||||
So(err, ShouldBeNil)
|
||||
So(len(manifestList), ShouldEqual, 1)
|
||||
@@ -369,7 +374,7 @@ func TestExtractImageDetails(t *testing.T) {
|
||||
So(err, ShouldBeNil)
|
||||
configDigest := godigest.FromBytes(configBlob)
|
||||
|
||||
olu := NewBaseOciLayoutUtils(storeController, testLogger)
|
||||
olu := ocilayout.NewBaseOciLayoutUtils(storeController, testLogger)
|
||||
resDigest, resManifest, resIspecImage, resErr := olu.ExtractImageDetails("zot-test", "latest", testLogger)
|
||||
So(string(resDigest), ShouldContainSubstring, "sha256:c52f15d2d4")
|
||||
So(resManifest.Config.Digest.String(), ShouldContainSubstring, configDigest.Encoded())
|
||||
@@ -388,7 +393,7 @@ func TestExtractImageDetails(t *testing.T) {
|
||||
DefaultStore: imageStore,
|
||||
}
|
||||
|
||||
olu := NewBaseOciLayoutUtils(storeController, testLogger)
|
||||
olu := ocilayout.NewBaseOciLayoutUtils(storeController, testLogger)
|
||||
resDigest, resManifest, resIspecImage, resErr := olu.ExtractImageDetails("zot-test",
|
||||
"latest", testLogger)
|
||||
So(resErr, ShouldEqual, zerr.ErrRepoNotFound)
|
||||
@@ -431,7 +436,7 @@ func TestExtractImageDetails(t *testing.T) {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
olu := NewBaseOciLayoutUtils(storeController, testLogger)
|
||||
olu := ocilayout.NewBaseOciLayoutUtils(storeController, testLogger)
|
||||
resDigest, resManifest, resIspecImage, resErr := olu.ExtractImageDetails("zot-test", "latest", testLogger)
|
||||
So(resErr, ShouldEqual, zerr.ErrBlobNotFound)
|
||||
So(string(resDigest), ShouldEqual, "")
|
||||
@@ -439,3 +444,47 @@ func TestExtractImageDetails(t *testing.T) {
|
||||
So(resIspecImage, ShouldBeNil)
|
||||
})
|
||||
}
|
||||
|
||||
func TestTagsInfo(t *testing.T) {
|
||||
Convey("Test tags info", t, func() {
|
||||
allTags := make([]cvemodel.TagInfo, 0)
|
||||
|
||||
firstTag := cvemodel.TagInfo{
|
||||
Name: "1.0.0",
|
||||
Descriptor: cvemodel.Descriptor{
|
||||
Digest: "sha256:eca04f027f414362596f2632746d8a178362170b9ac9af772011fedcc3877ebb",
|
||||
MediaType: ispec.MediaTypeImageManifest,
|
||||
},
|
||||
Timestamp: time.Now(),
|
||||
}
|
||||
secondTag := cvemodel.TagInfo{
|
||||
Name: "1.0.1",
|
||||
Descriptor: cvemodel.Descriptor{
|
||||
Digest: "sha256:eca04f027f414362596f2632746d8a179362170b9ac9af772011fedcc3877ebb",
|
||||
MediaType: ispec.MediaTypeImageManifest,
|
||||
},
|
||||
Timestamp: time.Now(),
|
||||
}
|
||||
thirdTag := cvemodel.TagInfo{
|
||||
Name: "1.0.2",
|
||||
Descriptor: cvemodel.Descriptor{
|
||||
Digest: "sha256:eca04f027f414362596f2632746d8a170362170b9ac9af772011fedcc3877ebb",
|
||||
MediaType: ispec.MediaTypeImageManifest,
|
||||
},
|
||||
Timestamp: time.Now(),
|
||||
}
|
||||
fourthTag := cvemodel.TagInfo{
|
||||
Name: "1.0.3",
|
||||
Descriptor: cvemodel.Descriptor{
|
||||
Digest: "sha256:eca04f027f414362596f2632746d8a171362170b9ac9af772011fedcc3877ebb",
|
||||
MediaType: ispec.MediaTypeImageManifest,
|
||||
},
|
||||
Timestamp: time.Now(),
|
||||
}
|
||||
|
||||
allTags = append(allTags, firstTag, secondTag, thirdTag, fourthTag)
|
||||
|
||||
latestTag := ocilayout.GetLatestTag(allTags)
|
||||
So(latestTag.Name, ShouldEqual, "1.0.3")
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user