feat: add additional manifest validations (#1609)

Signed-off-by: Petu Eusebiu <peusebiu@cisco.com>
This commit is contained in:
peusebiu
2023-07-13 19:31:39 +03:00
committed by GitHub
parent 730ef4aada
commit d3f27b4ba6
14 changed files with 626 additions and 85 deletions
+4 -4
View File
@@ -1503,11 +1503,11 @@ func runDisplayIndexTests(baseURL string) {
actual := strings.TrimSpace(str)
// Actual cli output should be something similar to (order of images may differ):
// REPOSITORY TAG OS/ARCH DIGEST SIGNED SIZE
// repo multi-arch * 59b25ae4 false 1.5kB
// repo multi-arch * 0f844b3e false 1.5kB
// linux/amd64 97b0d65c false 634B
// windows/arm64/v6 dcfa3a9c false 444B
So(actual, ShouldContainSubstring, "REPOSITORY TAG OS/ARCH DIGEST SIGNED SIZE")
So(actual, ShouldContainSubstring, "repo multi-arch * 59b25ae4 false 1.5kB ")
So(actual, ShouldContainSubstring, "repo multi-arch * 0f844b3e false 1.5kB ")
So(actual, ShouldContainSubstring, "linux/amd64 2ab1a275 false 634B ")
So(actual, ShouldContainSubstring, "windows/arm64/v6 55fdd23a false 501B")
})
@@ -1531,14 +1531,14 @@ func runDisplayIndexTests(baseURL string) {
actual := strings.TrimSpace(str)
// Actual cli output should be something similar to (order of images may differ):
// REPOSITORY TAG OS/ARCH DIGEST CONFIG SIGNED LAYERS SIZE
// repo multi-arch * 59b25ae4 false 1.5kB
// repo multi-arch * 0f844b3e false 1.5kB
// linux/amd64 2ab1a275 58cc9abe false 634B
// cbb5b121 4B
// a00291e8 4B
// windows/arm64/v6 55fdd23a 5132a1cd false 501B
// 7d08ce29 4B
So(actual, ShouldContainSubstring, "REPOSITORY TAG OS/ARCH DIGEST CONFIG SIGNED LAYERS SIZE")
So(actual, ShouldContainSubstring, "repo multi-arch * 59b25ae4 false 1.5kB")
So(actual, ShouldContainSubstring, "repo multi-arch * 0f844b3e false 1.5kB")
So(actual, ShouldContainSubstring, "linux/amd64 2ab1a275 58cc9abe false 634B")
So(actual, ShouldContainSubstring, "cbb5b121 4B")
So(actual, ShouldContainSubstring, "a00291e8 4B")
+10 -10
View File
@@ -28,8 +28,8 @@ func ref[T any](input T) *T {
}
const (
customArtTypeV1 = "custom.art.type.v1"
customArtTypeV2 = "custom.art.type.v2"
customArtTypeV1 = "application/custom.art.type.v1"
customArtTypeV2 = "application/custom.art.type.v2"
repoName = "repo"
)
@@ -263,8 +263,8 @@ func TestReferrerCLI(t *testing.T) {
str := strings.TrimSpace(space.ReplaceAllString(buff.String(), " "))
So(str, ShouldContainSubstring, "ARTIFACT TYPE SIZE DIGEST")
So(str, ShouldContainSubstring, "application/vnd.oci.image.config.v1+json 557 B "+ref1Digest.String())
So(str, ShouldContainSubstring, "custom.art.type.v1 535 B "+ref2Digest.String())
So(str, ShouldContainSubstring, "custom.art.type.v2 598 B "+ref3Digest.String())
So(str, ShouldContainSubstring, "application/custom.art.type.v1 547 B "+ref2Digest.String())
So(str, ShouldContainSubstring, "application/custom.art.type.v2 610 B "+ref3Digest.String())
fmt.Println(buff.String())
@@ -287,8 +287,8 @@ func TestReferrerCLI(t *testing.T) {
str = strings.TrimSpace(space.ReplaceAllString(buff.String(), " "))
So(str, ShouldContainSubstring, "ARTIFACT TYPE SIZE DIGEST")
So(str, ShouldContainSubstring, "application/vnd.oci.image.config.v1+json 557 B "+ref1Digest.String())
So(str, ShouldContainSubstring, "custom.art.type.v1 535 B "+ref2Digest.String())
So(str, ShouldContainSubstring, "custom.art.type.v2 598 B "+ref3Digest.String())
So(str, ShouldContainSubstring, "application/custom.art.type.v1 547 B "+ref2Digest.String())
So(str, ShouldContainSubstring, "application/custom.art.type.v2 610 B "+ref3Digest.String())
fmt.Println(buff.String())
})
@@ -370,8 +370,8 @@ func TestReferrerCLI(t *testing.T) {
str := strings.TrimSpace(space.ReplaceAllString(buff.String(), " "))
So(str, ShouldContainSubstring, "ARTIFACT TYPE SIZE DIGEST")
So(str, ShouldContainSubstring, "application/vnd.oci.image.config.v1+json 557 B "+ref1Digest.String())
So(str, ShouldContainSubstring, "custom.art.type.v1 535 B "+ref2Digest.String())
So(str, ShouldContainSubstring, "custom.art.type.v2 598 B "+ref3Digest.String())
So(str, ShouldContainSubstring, "application/custom.art.type.v1 547 B "+ref2Digest.String())
So(str, ShouldContainSubstring, "application/custom.art.type.v2 610 B "+ref3Digest.String())
fmt.Println(buff.String())
os.Remove(configPath)
@@ -391,8 +391,8 @@ func TestReferrerCLI(t *testing.T) {
str = strings.TrimSpace(space.ReplaceAllString(buff.String(), " "))
So(str, ShouldContainSubstring, "ARTIFACT TYPE SIZE DIGEST")
So(str, ShouldContainSubstring, "application/vnd.oci.image.config.v1+json 557 B "+ref1Digest.String())
So(str, ShouldContainSubstring, "custom.art.type.v1 535 B "+ref2Digest.String())
So(str, ShouldContainSubstring, "custom.art.type.v2 598 B "+ref3Digest.String())
So(str, ShouldContainSubstring, "application/custom.art.type.v1 547 B "+ref2Digest.String())
So(str, ShouldContainSubstring, "application/custom.art.type.v2 610 B "+ref3Digest.String())
fmt.Println(buff.String())
})
}