diff --git a/conformance/03_discovery_test.go b/conformance/03_discovery_test.go index 61a86caf..67b2b395 100644 --- a/conformance/03_discovery_test.go +++ b/conformance/03_discovery_test.go @@ -145,6 +145,18 @@ var test03ContentDiscovery = func() { BeNumerically("<", 300))) Expect(resp.Header().Get("OCI-Subject")).To(Equal(manifests[4].Digest)) + // Populate registry with test index manifest + req = client.NewRequest(reggie.PUT, "/v2//manifests/", + reggie.WithReference(refsIndexArtifactDigest)). + SetHeader("Content-Type", "application/vnd.oci.image.index.v1+json"). + SetBody(refsIndexArtifactContent) + resp, err = client.Do(req) + Expect(err).To(BeNil()) + Expect(resp.StatusCode()).To(SatisfyAll( + BeNumerically(">=", 200), + BeNumerically("<", 300))) + Expect(resp.Header().Get("OCI-Subject")).To(Equal(manifests[4].Digest)) + // Populate registry with test blob req = client.NewRequest(reggie.POST, "/v2//blobs/uploads/") resp, err = client.Do(req) @@ -300,7 +312,7 @@ var test03ContentDiscovery = func() { var index index err = json.Unmarshal(resp.Body(), &index) Expect(err).To(BeNil()) - Expect(len(index.Manifests)).To(Equal(4)) + Expect(len(index.Manifests)).To(Equal(5)) Expect(index.Manifests[0].Digest).ToNot(Equal(index.Manifests[1].Digest)) }) @@ -325,7 +337,7 @@ var test03ContentDiscovery = func() { Expect(len(index.Manifests)).To(Equal(2)) Expect(resp.Header().Get("OCI-Filters-Applied")).To(Equal(artifactTypeFilter)) } else { - Expect(len(index.Manifests)).To(Equal(4)) + Expect(len(index.Manifests)).To(Equal(5)) Warn("filtering by artifact-type is not implemented") } }) @@ -414,6 +426,9 @@ var test03ContentDiscovery = func() { if deleteManifestBeforeBlobs { req := client.NewRequest(reggie.DELETE, "/v2//manifests/", + reggie.WithReference(refsIndexArtifactDigest)) + deleteReq(req) + req = client.NewRequest(reggie.DELETE, "/v2//manifests/", reggie.WithReference(refsManifestAConfigArtifactDigest)) deleteReq(req) req = client.NewRequest(reggie.DELETE, "/v2//manifests/", @@ -445,6 +460,9 @@ var test03ContentDiscovery = func() { if !deleteManifestBeforeBlobs { // Delete manifest created in setup + req = client.NewRequest(reggie.DELETE, "/v2//manifests/", + reggie.WithReference(refsIndexArtifactDigest)) + deleteReq(req) req = client.NewRequest(reggie.DELETE, "/v2//manifests/", reggie.WithReference(refsManifestAConfigArtifactDigest)) deleteReq(req) diff --git a/conformance/image.go b/conformance/image.go index 75c1672b..23ac56ad 100644 --- a/conformance/image.go +++ b/conformance/image.go @@ -29,6 +29,9 @@ type manifest struct { // Subject is an optional link from the image manifest to another manifest forming an association between the image manifest and the other manifest. Subject *descriptor `json:"subject,omitempty"` + + // Annotations contains arbitrary metadata for the image index. + Annotations map[string]string `json:"annotations,omitempty"` } // descriptor describes the disposition of targeted content. @@ -90,9 +93,15 @@ type index struct { // MediaType specifies the type of this document data structure e.g. `application/vnd.oci.image.index.v1+json` MediaType string `json:"mediaType,omitempty"` + // ArtifactType specifies the IANA media type of artifact when the manifest is used for an artifact. + ArtifactType string `json:"artifactType,omitempty"` + // Manifests references platform specific manifests. Manifests []descriptor `json:"manifests"` + // Subject is an optional link from the image manifest to another manifest forming an association between the image manifest and the other manifest. + Subject *descriptor `json:"subject,omitempty"` + // Annotations contains arbitrary metadata for the image index. Annotations map[string]string `json:"annotations,omitempty"` } diff --git a/conformance/setup.go b/conformance/setup.go index 11ef3278..5f3058ff 100644 --- a/conformance/setup.go +++ b/conformance/setup.go @@ -112,6 +112,7 @@ var ( testRefBlobADigest string testRefArtifactTypeA string testRefArtifactTypeB string + testRefArtifactTypeIndex string testRefBlobB []byte testRefBlobBLength string testRefBlobBDigest string @@ -144,6 +145,8 @@ var ( refsManifestBConfigArtifactDigest string refsManifestBLayerArtifactContent []byte refsManifestBLayerArtifactDigest string + refsIndexArtifactContent []byte + refsIndexArtifactDigest string reportJUnitFilename string reportHTMLFilename string httpWriter *httpDebugWriter @@ -435,6 +438,35 @@ func init() { refsManifestBLayerArtifactDigest = godigest.FromBytes(refsManifestBLayerArtifactContent).String() + testRefArtifactTypeIndex = "application/vnd.food.stand" + refsIndexArtifact := index{ + SchemaVersion: 2, + MediaType: "application/vnd.oci.image.index.v1+json", + ArtifactType: testRefArtifactTypeIndex, + Manifests: []descriptor{ + { + MediaType: "application/vnd.oci.image.manifest.v1+json", + Size: int64(len(refsManifestAConfigArtifactContent)), + Digest: godigest.FromBytes(refsManifestAConfigArtifactContent), + }, + { + MediaType: "application/vnd.oci.image.manifest.v1+json", + Size: int64(len(refsManifestALayerArtifactContent)), + Digest: godigest.FromBytes(refsManifestALayerArtifactContent), + }, + }, + Subject: &descriptor{ + MediaType: "application/vnd.oci.image.manifest.v1+json", + Size: int64(len(manifests[4].Content)), + Digest: godigest.FromBytes(manifests[4].Content), + }, + } + refsIndexArtifactContent, err = json.MarshalIndent(&refsIndexArtifact, "", "\t") + if err != nil { + log.Fatal(err) + } + refsIndexArtifactDigest = godigest.FromBytes(refsIndexArtifactContent).String() + dummyDigest = godigest.FromString("hello world").String() errorCodes = []string{