Skip to content
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

test: deflake http-server-request-timeout test #44169

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions test/parallel/test-http-server-request-timeouts-mixed.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const responseOk = 'HTTP/1.1 200 OK\r\n';
const responseTimeout = 'HTTP/1.1 408 Request Timeout\r\n';

const headersTimeout = common.platformTimeout(2000);
const connectionsCheckingInterval = headersTimeout / 4;
const connectionsCheckingInterval = headersTimeout / 8;

const server = createServer({
headersTimeout,
Expand Down Expand Up @@ -76,7 +76,8 @@ server.listen(0, common.mustCall(() => {

// Send the second request, stop in the middle of the headers
request2.client.write(requestBodyPart1);
// Send the second request, stop in the middle of the headers

// Send the third request and stop in the middle of the headers
request3.client.write(requestBodyPart1);
}, headersTimeout * 0.2);

Expand Down Expand Up @@ -111,7 +112,7 @@ server.listen(0, common.mustCall(() => {

assert(request1.response.startsWith(responseOk));
assert(request2.response.startsWith(responseTimeout)); // It is expired due to headersTimeout
}, headersTimeout * 1.2 + connectionsCheckingInterval);
}, headersTimeout * 1.4);

setTimeout(() => {
// Complete the body for the fourth request
Expand Down