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

Use lowercase "id" in stats API, for Docker compatibility #17870

Closed
wants to merge 1 commit into from

Conversation

kierendavies
Copy link

Fixes #17869

[NO NEW TESTS NEEDED]

Does this PR introduce a user-facing change?

Changed stats API response `"Id"` to `"id"`, for Docker compatibility

Fixes containers#17869

[NO NEW TESTS NEEDED]

Signed-off-by: Kieren Davies <[email protected]>
@github-actions github-actions bot added the kind/api-change Change to remote API; merits scrutiny label Mar 21, 2023
@rhatdan
Copy link
Member

rhatdan commented Mar 21, 2023

LGTM
@vrothberg PTAL
/approve
Thanks @kierendavies

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 21, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kierendavies, 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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 21, 2023
Copy link
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

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

Thanks for the patch, while the change is correct for the docker API it is not correct for the libpod API because this might break existing users and we use the same endpoint for both, see

r.HandleFunc(VersionedPath("/libpod/containers/{name}/stats"), s.APIHandler(compat.StatsContainer)).Methods(http.MethodGet)

So you need to add a new type for it and then you can check inside the API handler function with utils.IsLibpodRequest(r) if it was a libpod or docker API request and use the correct type.

Second, please do not use [NO NEW TESTS NEEDED], changes like that can and should be tested. The label is only meant for things that cannot be tested. Take a look at test/apvi2 to see some existing API tests.

@kierendavies
Copy link
Author

please do not use [NO NEW TESTS NEEDED]

My apologies @Luap99! My reasoning was that a test for a specific field name is really just a duplicate of the definition of that field name.

Adding a new type affects code organisation, so I think I'd best leave those changes to someone more familiar with the norms of this codebase (or with more time to become familiar).

@Luap99
Copy link
Member

Luap99 commented Mar 22, 2023

No need to apologize, PRs are always welcome. For most endpoints this change would have been fine but not for this one.

I created #17890 to fix it without changing the libpod output. Feel free to test it.

@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 4, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/api-change Change to remote API; merits scrutiny locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. release-note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stats response has "Id" field instead of "id"
3 participants