-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
fix parseApi to not throw and to match apiVersion more specifically #496
Conversation
Signed-off-by: Sebastian Malton <smalton@mirantis.com>
bcad7cd
to
1107ff3
Compare
- Add many more unit tests (these are exact copies of the old behaviour so that any changes do not change behaviour) - Make explicit, with documentation, why certain actions are being taken with the parsing of the api URL parts Signed-off-by: Sebastian Malton <smalton@mirantis.com>
@nevalla @jakolehm This PR should be the last one (I am so sorry it took so many attempts). I have spent extra time verifying that nothing else is broken (especially side bars) and have added many more unit tests to make sure that any changes I need to make don't change behaviour on the previously working strings. I guess this goes to show how much testing can be beneficial. |
Signed-off-by: Sebastian Malton <smalton@mirantis.com>
454e31a
to
e20d2f3
Compare
@Nokel81 this PR seems to break namespace details. |
[apiGroup, apiVersion, resource] = left; | ||
switch (left.length) { | ||
case 2: | ||
resource = left.pop(); |
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.
Forgot break
?
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 meant to leave that out, but I will add some more tests once I find which is wrong...
…496) * remove the explicit throw is new parseApi * fix parseApi to be more consitent with the older version - Add many more unit tests (these are exact copies of the old behaviour so that any changes do not change behaviour) - Make explicit, with documentation, why certain actions are being taken with the parsing of the api URL parts Signed-off-by: Sebastian Malton <smalton@mirantis.com> Co-authored-by: Sebastian Malton <smalton@mirantis.com>
Signed-off-by: Sebastian Malton smalton@mirantis.com
This PR removes the explicit throw in
parseApi
. That function is assumed by several parts of the code to be "no-throw" and to return an empty (ish) object if the passed in URL is not an API URL.Add a unit test to cover this case.