-
Notifications
You must be signed in to change notification settings - Fork 22
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
fix: improve error handling for Prism Client #354
fix: improve error handling for Prism Client #354
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #354 +/- ##
=======================================
Coverage 13.62% 13.62%
=======================================
Files 4 4
Lines 1013 1013
=======================================
Hits 138 138
Misses 875 875 ☔ View full report in Codecov by Sentry. |
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.
Let's improve var naming little bit.
/ok-to-test |
@faiq can you also rebase this against the latest changes in main. |
ff401c1
to
cf34f59
Compare
/retest |
1 similar comment
/retest |
cf8bea5
to
40872bd
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: faiq, thunderboltsid 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 |
/retest |
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.
LGTM
1f8716d
into
nutanix-cloud-native:main
* fix: use wrapper errors to clearly denote issues in client building * fix: adds a function to properly sanitize the address * fix: adds tests for ip address case given * fix: uses a defined type for port error * fix: clean up variable naming * fix: remove validation here to be moved into prism-client
* fix: use wrapper errors to clearly denote issues in client building * fix: adds a function to properly sanitize the address * fix: adds tests for ip address case given * fix: uses a defined type for port error * fix: clean up variable naming * fix: remove validation here to be moved into prism-client
* fix: use wrapper errors to clearly denote issues in client building * fix: adds a function to properly sanitize the address * fix: adds tests for ip address case given * fix: uses a defined type for port error * fix: clean up variable naming * fix: remove validation here to be moved into prism-client
* fix: improve error handling for Prism Client (#354) * fix: use wrapper errors to clearly denote issues in client building * fix: adds a function to properly sanitize the address * fix: adds tests for ip address case given * fix: uses a defined type for port error * fix: clean up variable naming * fix: remove validation here to be moved into prism-client * refactor: task status file (#355) * test: add unit tests for pkg/client/state * refactor: use wait.Poll function waiting for task state * refactor: use consistent task status names * fixup! test: add unit tests for pkg/client/state * fix: revert to previous behaviod polling forever The ctx passed into WaitForTaskToSucceed is only used to cancel HTTP reqests and not to cancel the wait. * chore: add license headers * fix: better function name * refactor: client.go file helper methods (#360) * refactor: client.go file helper methods Refactored the existing methods and functions to be unit testable. Also made some methods that do not use the struct as generic functions. The changes were primarily an effort to add unit test coverage. * refactor: more testable read file function * test: new nutanixcluster types unit tests * test: additional test cases for errors * fixup! refactor: client.go file helper methods * fixup! refactor: client.go file helper methods * fixup! refactor: more testable read file function * fixup! refactor: client.go file helper methods * Switch Nutanix Client to using Session Auth (#398) This will ensure we make fewer basic auth requests to Prism Central IAM Services. --------- Co-authored-by: Faiq <faiq.raza@nutanix.com> Co-authored-by: Dimitri Koshkin <dimitri.koshkin@nutanix.com>
What this PR does / why we need it:
This adds some logic to properly format the prismCentral address string if a user provides an address with a scheme or port already included. It also adds error wrapping to clearly note where any issues might be coming from.
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes errors from bad user input
previously if a user provided an address such as `https://prismcentral.com" this would cause a failure like this
this code now strips out the scheme and port number from the address if it is provided.
How Has This Been Tested?:
I deployed this to a local kind cluster. Previously I was seeing errors such as
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration and test output
Special notes for your reviewer:
Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.
Release note: