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
Add unit test of retry support #179
Conversation
Add unit test of retry policy.
TODO:
|
Add unit test of dont retry policy/temporary network error. Disable delay on retry unit test.
Thanks for PR. The approach looks good. |
Add unit test of max retries and retry delay.
FYI: I've created discord chat for httpexpect. It can be used when we need more interactive discussion. |
ok got it @gavv this PR is ready now |
Thanks, tests look good. Can we make a few small improvements?
|
ok will do the update
i see. agree. btw could you point out where (in which file) the special logic is?
i see. i'm ok with that. will do the update too |
@gavv btw for the |
CMIIW i think the update more into adding test related to context cancellation isn't it? if so, i think the adjustment will not be that big |
Nope. Better let's keep this thing internal, so that only tests can override sleep function. I think this is too low-level detail to be exposed to user.
Yep.
#163 will change the way how we sleep from time.Sleep to something like time.After. So the signature of sleepFn will change and retry tests should be adjusted. But yes, this will be a small change. |
At the beginning of retryRequest we wrap Body with bodyWrapper. Then, before each retry, we call Rewind method to make the body readable again. |
got it btw perhaps i will update this PR next week |
Add unit test of retry on HTTP Status OK.
Update mockClient.cb to have *http.Request. Add HTTP request body assertions.
Add sleepFn to Request.
hi @gavv , after implementing i keep getting this error when running the tests
i am clueless about this assertion error mind to help? thank you |
Good catch! It's interesting. We see accidental combination of several factors:
The proper fix is the following:
I've implemented both fixes in 3358138 and pushed to master. Please rebase your branch on master and the bug should go away. |
@gavv got it will update by this week including the sleepFn implementation in unit test |
@gavv i've added the please LMK if there is anything thank you |
Great! One last small thing: I think in all retry tests we can set sleepFn to no-op, so that there were no unnecessary delays at all, right? |
got it will do the update |
Add no-op sleepFn to remove unnecessary delay.
updated 1d97cd5 |
Thanks! Impressive work! |
Issue: #91