-
Notifications
You must be signed in to change notification settings - Fork 198
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
pkg/manifests.list.AddInstance(): don't set Platform to an empty struct #1819
pkg/manifests.list.AddInstance(): don't set Platform to an empty struct #1819
Conversation
89fdd08
to
f717d6c
Compare
If the Platform struct for an OCI instance being added to an image index is empty, set the Platform pointer field in the Descriptor struct to `nil` instead of setting it to point to a Platform struct filled with empty values. I expect this to be the case for at least some OCI artifacts being added to indexes. Likewise, if we're updating the Platform for an OCI instance and its value goes to zero, set its pointer to `nil` to avoid the same case. When reading information back from a descriptor, or setting a field in the Platform struct, don't assume that Platform is (already) set to a non-nil value. Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
f717d6c
to
5030765
Compare
LGTM |
pkg/filters/filters_test.go
Outdated
sort.Strings(expectedLibpodFilters) | ||
sort.Strings(got) |
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.
I think you can use assert.ElementsMatch()
instead of sorting explicitly
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.
Ooh, that's a good one. I missed that somehow when doing a search of the functions in the package. Changing it.
Compare the two string slices in this test using ElementsMatch(), which ignores the order. One of them is built using a map traversal, the order of which is not guaranteed, so the regular equality check can fail. Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
e1289a6
to
ff69f79
Compare
Any other review comments, anyone? |
/lgtm |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: nalind, rhatdan The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
If the Platform struct for an OCI instance being added to an image index is empty, set the Platform pointer field in the Descriptor struct to
nil
instead of setting it to point to a Platform struct filled with empty values. I expect this to be the case for at least some OCI artifacts being added to indexes.Likewise, if we're updating the Platform for an OCI instance and its value goes to zero, set its pointer to
nil
to avoid the same case.When reading information back from a descriptor, or setting a field in the Platform struct, don't assume that Platform is (already) set to a non-nil value.