-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Avoid retries by default when using the MockClient #12354
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
Avoid retries by default when using the MockClient #12354
Conversation
🦋 Changeset detectedLatest commit: 001bc9f The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
…est-mock-500-responses-not
@@ -183,7 +183,7 @@ describe('rollback', () => { | |||
`Fetching deployment "${previousDeployment.id}" in ${previousDeployment.creator?.username}` | |||
); | |||
// we need to wait a super long time because fetch will return on 500 |
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.
I think we can remove this comment now too. It wasn't even terribly accurate.
…est-mock-500-responses-not
When some of our test mocks intentionally respond with a 500, that response takes several seconds because the [client's `fetch` function](https://github.com/vercel/vercel/blob/7e8fbd20e01135513ad28936155b078650732d37/packages/cli/src/util/client.ts#L173-L174) automatically retries the request. But since we're mocking these requests we should just automatically fail.
For those of us who use a debugger, the test suit exiting early is frustrating. You can get around this by setting this value yourself or running with `--testTimeout` in the terminal but adding this behavior globally seems like a nice quality of life change. I couldn't find a 100% guaranteed way to detect if node is in debug mode but the rough consensus was detecting `debugPort` covered the largest number of cases. I audited all the uses of `vi.setConfig({ testTimeout });` in `packages/cli` and only found one that looked like it could definitely be removed. The use case it covered was negated by #12354. The others mostly came from 413706d or had a comment explaining their need.
For those of us who use a debugger, the test suit exiting early is frustrating. You can get around this by setting this value yourself or running with `--testTimeout` in the terminal but adding this behavior globally seems like a nice quality of life change. I couldn't find a 100% guaranteed way to detect if node is in debug mode but the rough consensus was detecting `debugPort` covered the largest number of cases. I audited all the uses of `vi.setConfig({ testTimeout });` in `packages/cli` and only found one that looked like it could definitely be removed. The use case it covered was negated by vercel/vercel#12354. The others mostly came from vercel/vercel@fa07756 or had a comment explaining their need.
When some of our test mocks intentionally respond with a 500, that response takes several seconds because the client's
fetch
function automatically retries the request.But since we're mocking these requests we should just automatically fail.