-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Better error message checking #1249
Conversation
Currently, we check exactly matching of error message return by go standard library. It's working nowaday but not guaranteed to work in upcoming go version. At least in go1.14, all the certificate expried message checking test will fail, due to the change of error message format in net/http. To fix this, we only check that error message contains the message we want, e.g certificate expired error should contain word "expired". While at it, also add some require.NoError to make sure no editor complains above "can lead to nil pointer dereference".
9306558
to
7c9ded2
Compare
Codecov Report
@@ Coverage Diff @@
## master #1249 +/- ##
=========================================
+ Coverage 75.28% 75.3% +0.01%
=========================================
Files 149 149
Lines 10841 10841
=========================================
+ Hits 8162 8164 +2
+ Misses 2212 2210 -2
Partials 467 467
Continue to review full report at Codecov.
|
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, but can you link to some issues/CL around this as we might need to do other changes ?
You mean this golang/go#34066? |
Currently, we check exactly matching of error message return by go
standard library. It's working nowaday but not guaranteed to work in
upcoming go version. At least in go1.14, all the certificate expried
message checking test will fail, due to the change of error message
format in net/http.
To fix this, we only check that error message contains the message we
want, e.g certificate expired error should contain word "expired".
While at it, also add some require.NoError to make sure no editor
complains above "can lead to nil pointer dereference".