conformance: initial commit for references test#375
conformance: initial commit for references test#375jdolitsky merged 1 commit intoopencontainers:mainfrom
Conversation
e28419c to
eb5ccad
Compare
|
Testing against zot ... |
|
can you rebase? |
180974d to
18ab2cb
Compare
|
@jdolitsky @sudo-bmitch @sajayantony FYI, top of |
sudo-bmitch
left a comment
There was a problem hiding this comment.
@rchincha thanks for getting this started! I've got a bunch of feedback, but we're on the right path with this.
conformance/05_referrers.go
Outdated
| // also check resp header "OCI-Filters-Applied: artifactType" denoting that an artifactType filter was applied | ||
| Expect(resp.Header().Get("OCI-Filters-Applied")).ToNot(BeEmpty()) | ||
| Expect(resp.Header().Get("OCI-Filters-Applied")).To(Equal("application/vnd.oci.conformance")) |
There was a problem hiding this comment.
Filter support is a SHOULD, so at most we can warn. I'd prefer we push a third referrer with a different type, and then conditionally handle the response based on if the registry returns the OCI-Filters-Applied header. If it's missing, all 3 referrers should be returned. Otherwise if the header is defined with the requested value, we should verify the two requested referrers were returned and not the 3rd.
There was a problem hiding this comment.
WARN: you have failed this test, but ignoring
Expected
<string>: application/vnd.nhl.peanut.butter.bagel
to equal
<string>:
^ warn support added
There was a problem hiding this comment.
Modified implementation.
conformance/setup.go
Outdated
| scratchDescriptor = Descriptor{ | ||
| MediaType: "application/vnd.oci.scratch.v1+json", | ||
| Size: 2, | ||
| Digest: godigest.FromString("sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a"), | ||
| } |
There was a problem hiding this comment.
Pending the result of opencontainers/image-spec#1068
There was a problem hiding this comment.
Used same empty JSON descriptor
4683bf1 to
2e3cfc1
Compare
conformance/05_referrers.go
Outdated
| Expect(len(index.Manifests)).To(Equal(2)) | ||
|
|
||
| // also check resp header "OCI-Filters-Applied: artifactType" denoting that an artifactType filter was applied | ||
| Expect(resp.Header().Get("OCI-Filters-Applied")).To(EqualOrWarn(testRefArtifactTypeA)) |
There was a problem hiding this comment.
Since filter support is a "SHOULD", the length and header check here needs to be conditional. If the header is set, then we expect 2 entries and the header must match the expected value. Else, we'd expect 4 manifests.
There was a problem hiding this comment.
Maybe we don't need the "warn" after all.
9769a96 to
627be76
Compare
sudo-bmitch
left a comment
There was a problem hiding this comment.
Couple minor updates. Does Zot still pass after the latest changes?
conformance/image.go
Outdated
| // Artifact describes an artifact manifest. | ||
| // This structure provides `application/vnd.oci.artifact.manifest.v1+json` mediatype when marshalled to JSON. | ||
| type Artifact struct { | ||
| // MediaType is the media type of the object this schema refers to. | ||
| MediaType string `json:"mediaType"` | ||
|
|
||
| // ArtifactType is the IANA media type of the artifact this schema refers to. | ||
| ArtifactType string `json:"artifactType,omitempty"` | ||
|
|
||
| // Blobs is a collection of blobs referenced by this manifest. | ||
| Blobs []Descriptor `json:"blobs,omitempty"` | ||
|
|
||
| // Subject (reference) is an optional link from the artifact to another manifest forming an association between the artifact and the other manifest. | ||
| Subject *Descriptor `json:"subject,omitempty"` | ||
|
|
||
| // Annotations contains arbitrary metadata for the artifact manifest. | ||
| Annotations map[string]string `json:"annotations,omitempty"` | ||
| } |
Yes, top of |
|
Made the warning code/output a little "nicer" |
| func Warn(message string) { | ||
| fmt.Fprintf(colorable.NewColorableStderr(), "\n") | ||
| // print file:line | ||
| _, file, line, _ := runtime.Caller(1) | ||
| warncolor := color.New(color.FgMagenta).FprintfFunc() | ||
| warncolor(colorable.NewColorableStderr(), formatter.Fi(2, "\nWARNING: "+message)) | ||
| fmt.Fprintf(colorable.NewColorableStderr(), "\n") | ||
| // print message | ||
| msgcolor := color.New(color.FgWhite).FprintfFunc() | ||
| msgcolor(colorable.NewColorableStderr(), formatter.Fi(2, "\n")) | ||
| msgcolor(colorable.NewColorableStderr(), formatter.Fi(2, "%s:%d\n", file, line)) | ||
| } |
There was a problem hiding this comment.
@jdolitsky is there any issue generating warnings in the conformance test this way?
There was a problem hiding this comment.
Rebased and updated after recent merges.
https://github.com/opencontainers/distribution-spec/blob/main/spec.md#enabling-the-referrers-api Based off of 01_pull_test.go Fixes opencontainers#370 https://github.com/opencontainers/image-spec/blob/main/manifest.md#guidelines-for-artifact-usage Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
|
As a data point, top of ••••••••••••••••••••••••••••••••••HTML report was created: /local/rchincha/go/src/github.com/opencontainers/distribution-spec/conformance/report.html Ran 81 of 86 Specs in 0.255 seconds |
|
Instrumented zot warns like so, |
|
opencontainers/image-spec#1077 |
https://github.com/opencontainers/distribution-spec/blob/main/spec.md#enabling-the-referrers-api Based off of 01_pull_test.go Fixes opencontainers#370 https://github.com/opencontainers/image-spec/blob/main/manifest.md#guidelines-for-artifact-usage Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
Based off of 01_pull_test.go
Fixes #370
Signed-off-by: Ramkumar Chinchani rchincha@cisco.com