-
Notifications
You must be signed in to change notification settings - Fork 204
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
Improve record/replay tests #1492
Conversation
b7e3f61
to
b4da5b4
Compare
Codecov Report
@@ Coverage Diff @@
## master #1492 +/- ##
==========================================
+ Coverage 62.13% 62.20% +0.07%
==========================================
Files 161 163 +2
Lines 10695 10730 +35
==========================================
+ Hits 6645 6675 +30
- Misses 3414 3415 +1
- Partials 636 640 +4
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 - left a few comments/questions though.
hack/generated/pkg/testcommon/error_translating_roundtripper.go
Outdated
Show resolved
Hide resolved
hack/generated/pkg/testcommon/error_translating_roundtripper.go
Outdated
Show resolved
Hide resolved
hack/generated/pkg/testcommon/error_translating_roundtripper.go
Outdated
Show resolved
Hide resolved
Co-authored-by: Matthew Christopher <matthchr@microsoft.com>
A few changes here:
Check bodies in requests
This makes sure the request/response pair is for the correct request (by default,
go-vcr
only checks the HTTP method/URL). To achieve this we blank out any dates/timestamps that are found in bodies, since they cause a mismatch when the test is rerun.Fix "count" header addition
We had code to track the request count at a per-URL level so that we handle multiple requests to the same URL properly in recordings (so that a series of polling GETs can get back different responses, for example), but this was not being added properly. Now it is.
Better messages when go-vcr interaction cannot be found
At the moment when running record/replay tests and an interaction (request+response) cannot be located, it is hard to figure out what went wrong. This PR adds a wrapper around the
go-vcr
code to add more context about what went wrong.An example message in the output looks like:
Ideally we would
panic
when this happens, but we can't at the moment (the code explains why).Closes #1432.
How does this PR make you feel: