-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
conformance: initial commit for references test #375
Conversation
e28419c
to
eb5ccad
Compare
Testing against zot ...
|
can you rebase? |
180974d
to
18ab2cb
Compare
@jdolitsky @sudo-bmitch @sajayantony FYI, top of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pending the result of opencontainers/image-spec#1068
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we don't need the "warn" after all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
9769a96
to
627be76
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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"` | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Delete.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
Yes, top of
|
Made the warning code/output a little "nicer" |
conformance/setup.go
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jdolitsky is there any issue generating warnings in the conformance test this way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <[email protected]>
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 <[email protected]>
Based off of 01_pull_test.go
Fixes #370
Signed-off-by: Ramkumar Chinchani [email protected]