mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
test: reduce http-server-request-timeouts-mixed flakiness
parallel/test-http-server-request-timeouts-mixed.js test was sometimes failing due to insufficient tolerance between the connection timeout checking interval, and the expected timeout specified in the test. This change makes the checking interval more frequent, and decouples the timeout for the check from the checking interval. PR-URL: https://github.com/nodejs/node/pull/44169 Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
@@ -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,
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user