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

pkg/client/fake/client.go: get gvk without potential panic in List() #215

Closed
wants to merge 1 commit into from

Conversation

estroz
Copy link
Contributor

@estroz estroz commented Nov 15, 2018

Unless opts.Raw.TypeMeta is explicitly populated, client.List() panics. As noted in #168, population is not necessary outside of the fake client. This simple fix does essentially the same thing as unstructuredClient.List().

Closes #168

@k8s-ci-robot
Copy link
Contributor

Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA.

It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.


Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Nov 15, 2018
@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Nov 15, 2018
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: estroz
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: directxman12

If they are not already assigned, you can assign the PR to them by writing /assign @directxman12 in a comment when ready.

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

@estroz estroz changed the title pkg/client/fake/client.go: get gvk without potential panic in List() [WIP] pkg/client/fake/client.go: get gvk without potential panic in List() Nov 15, 2018
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 15, 2018
@estroz
Copy link
Contributor Author

estroz commented Nov 16, 2018

Signed

@estroz estroz changed the title [WIP] pkg/client/fake/client.go: get gvk without potential panic in List() pkg/client/fake/client.go: get gvk without potential panic in List() Nov 16, 2018
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 16, 2018
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Nov 16, 2018
@sverrirsig
Copy link

Thank you! - List() now works perfectly 👍

@grantr
Copy link
Contributor

grantr commented Nov 19, 2018

This is quite similar to #213. 😃

@estroz
Copy link
Contributor Author

estroz commented Nov 21, 2018

@grantr yes your solution looks better. I'll close this if @DirectXMan12 @droot give the ok.

@droot
Copy link
Contributor

droot commented Nov 21, 2018

@estroz Thanks for submitting this fix. Took at a look at #213 which also addresses this issue and improves the code/tests also, so lets close this in favor of #213 .

@estroz estroz closed this Nov 22, 2018
@estroz estroz deleted the fix-168 branch November 22, 2018 04:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Panic in fake client
5 participants