Skip to content

Commit b4224dd

Browse files
nicksia-vgwruyadorno
authored andcommitted
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: #44169 Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 9614907 commit b4224dd

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

test/parallel/test-http-server-request-timeouts-mixed.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const responseOk = 'HTTP/1.1 200 OK\r\n';
1515
const responseTimeout = 'HTTP/1.1 408 Request Timeout\r\n';
1616

1717
const headersTimeout = common.platformTimeout(2000);
18-
const connectionsCheckingInterval = headersTimeout / 4;
18+
const connectionsCheckingInterval = headersTimeout / 8;
1919

2020
const server = createServer({
2121
headersTimeout,
@@ -76,7 +76,8 @@ server.listen(0, common.mustCall(() => {
7676

7777
// Send the second request, stop in the middle of the headers
7878
request2.client.write(requestBodyPart1);
79-
// Send the second request, stop in the middle of the headers
79+
80+
// Send the third request and stop in the middle of the headers
8081
request3.client.write(requestBodyPart1);
8182
}, headersTimeout * 0.2);
8283

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

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

116117
setTimeout(() => {
117118
// Complete the body for the fourth request

0 commit comments

Comments
 (0)