Skip to content
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

Add conformance test coverage for data field #318

Merged
merged 1 commit into from
Aug 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions conformance/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ type Descriptor struct {
// Size specifies the size in bytes of the blob.
Size int64 `json:"size"`

// Data specifies the data of the object described by the descriptor.
Data []byte `json:"data"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from the referenced commit

	// Data is an embedding of the targeted content. This is encoded as a base64
 	// string when marshalled to JSON (automatically, by encoding/json). If
 	// present, Data can be used directly to avoid fetching the targeted content.
 	Data []byte `json:"data,omitempty"`

don't see how Data could be empty from this test bucket.. just a nit...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't even seem to matter either way. An empty []byte with and without the struct tag results in {} in my tests in the Go Playground.


// NewUnspecifiedField is not covered by image-spec.
// Registry implementations should still successfully store and serve
// manifests containing this data.
Expand Down
6 changes: 4 additions & 2 deletions conformance/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,8 @@ func init() {
MediaType: "application/vnd.oci.image.config.v1+json",
Digest: godigest.Digest(configs[i].Digest),
Size: int64(len(configs[i].Content)),
NewUnspecifiedField: configs[i].Content,
Data: configs[i].Content, // must be the config content.
NewUnspecifiedField: []byte("hello world"), // content doesn't matter.
},
Layers: layers,
}
Expand Down Expand Up @@ -258,7 +259,8 @@ func init() {
MediaType: "application/vnd.oci.image.config.v1+json",
Digest: godigest.Digest(configs[1].Digest),
Size: int64(len(configs[1].Content)),
NewUnspecifiedField: configs[1].Content,
Data: configs[1].Content, // must be the config content.
NewUnspecifiedField: []byte("hello world"), // content doesn't matter.
},
Layers: []Descriptor{},
}
Expand Down