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

Word breaking fails for kind APIService #605

Open
2 of 3 tasks
cben opened this issue Feb 10, 2023 · 1 comment
Open
2 of 3 tasks

Word breaking fails for kind APIService #605

cben opened this issue Feb 10, 2023 · 1 comment

Comments

@cben
Copy link
Collaborator

cben commented Feb 10, 2023

It gets method names like get_apiservice, get_apiservices.

  • The updated algorithm on master branch correctly splits underscore_entity("APIService") -> "api_service".
  • However, parse_definition computes prefix it can match against the given lowercase plural, up to the last capital letter.
    • Normally you get e.g. "NetworkP" + "olicy"/"olicies" -> "network_p" + "olicy"/"olicies".
    • But when prefix is all uppercase e.g. "APIS", we compute underscore_entity("APIS") -> "apis", to which we append "ervice"/"ervices" to construct "apiservice", "apiservices" ☹️

We have all the information here that "Service" is a separate word, but we're not passing it into underscore_entity. 🤔

cben added a commit to cben/kubeclient that referenced this issue Feb 12, 2023
Upper-only `DNS` and upper-at-end `ServiceCA` seen in operator.openshift.io/v1.

TODO: found bug ManageIQ#605 - failing test for `APIService`.

Swapped expected, actual to minitest's order (for less confusing messages).
@cben
Copy link
Collaborator Author

cben commented Feb 12, 2023

Funnily enough, this was the motivating case for the original change #355, but all the pretty tables where I listed it as changed there were based on testing underscore_entity and not the actual method names produced by parse_definition 😳

  • EDIT: there were several PRs touching this code area around same time, so it's possible this worked originally and got lost later in rebases? Anyway, the incomplete test coverage is what allowed this.

FYI @eatwithforks

I have an idea how to fix this by passing whole kind to parse_definition, but need to see if it will work out...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant