-
Notifications
You must be signed in to change notification settings - Fork 594
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
client: fix specificErr handling in SnapshotExport() #13001
Conversation
The code was checking generating a `specificErr` but then checked `if err != nil {` (and not check for specificErr) and also lacked a unit test. When adding the code test it became clear that the other issue there is that the response body was never read so r.err() would always return nil. This commit fixes both issues.
@@ -142,6 +142,15 @@ func (cs *clientSuite) TestClientCheckSnapshots(c *check.C) { | |||
func (cs *clientSuite) TestClientRestoreSnapshots(c *check.C) { | |||
cs.testClientSnapshotAction(c, "restore", cs.cli.RestoreSnapshots) | |||
} | |||
func (cs *clientSuite) TestClientExportSnapshotSpecificErr(c *check.C) { |
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.
Should we have also a test where the body is not json formatted?
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.
Yes, I think that would be good, I will see if I can do a small followup here.
Co-authored-by: Miguel Pires <miguelpires94@gmail.com>
Codecov Report
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. @@ Coverage Diff @@
## master #13001 +/- ##
==========================================
+ Coverage 78.67% 78.69% +0.01%
==========================================
Files 999 1000 +1
Lines 123889 124140 +251
==========================================
+ Hits 97474 97691 +217
- Misses 20279 20300 +21
- Partials 6136 6149 +13
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 25 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
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, thank you!
* client: fix specificErr handling in SnapshotExport() The code was checking generating a `specificErr` but then checked `if err != nil {` (and not check for specificErr) and also lacked a unit test. When adding the code test it became clear that the other issue there is that the response body was never read so r.err() would always return nil. This commit fixes both issues. * client: fix TestClientExportSnapshotSpecificErr naming Co-authored-by: Miguel Pires <miguelpires94@gmail.com> --------- Co-authored-by: Miguel Pires <miguelpires94@gmail.com>
The code was checking generating a
specificErr
but then checkedif err != nil {
(and not check for specificErr) and also lacked a unit test.When adding the code test it became clear that the other issue there is that the response body was never read so r.err() would always return nil.
This commit fixes both issues.