Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTobias Nießen <tniessen@tnie.de>2022-04-24 18:59:37 +0300
committerMichaël Zasso <targos@protonmail.com>2022-04-28 07:57:23 +0300
commit37364abc58416ef59b498a038cf7eac5693605a4 (patch)
tree910700cdf35359d0ffe711da067ff6759b5ba0e8 /test
parent0e16120d0dcaa0eb6e075325d077480caf8c3e7a (diff)
test: fix flaky HTTP server tests
Refs: https://github.com/nodejs/node/pull/41263 PR-URL: https://github.com/nodejs/node/pull/42846 Fixes: https://github.com/nodejs/node/issues/42741 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Diffstat (limited to 'test')
-rw-r--r--test/parallel/test-http-server-headers-timeout-keepalive.js9
-rw-r--r--test/parallel/test-http-server-request-timeout-keepalive.js9
2 files changed, 6 insertions, 12 deletions
diff --git a/test/parallel/test-http-server-headers-timeout-keepalive.js b/test/parallel/test-http-server-headers-timeout-keepalive.js
index c7e5e56da90..05531087ed8 100644
--- a/test/parallel/test-http-server-headers-timeout-keepalive.js
+++ b/test/parallel/test-http-server-headers-timeout-keepalive.js
@@ -14,9 +14,6 @@ function performRequestWithDelay(client, firstDelay, secondDelay, closeAfter) {
client.resume();
client.write('GET / HTTP/1.1\r\n');
- firstDelay = common.platformTimeout(firstDelay);
- secondDelay = common.platformTimeout(secondDelay);
-
setTimeout(() => {
client.write('Connection: ');
}, firstDelay).unref();
@@ -27,12 +24,12 @@ function performRequestWithDelay(client, firstDelay, secondDelay, closeAfter) {
}, firstDelay + secondDelay).unref();
}
-const headersTimeout = common.platformTimeout(1000);
+const headersTimeout = common.platformTimeout(2000);
const server = createServer({
headersTimeout,
requestTimeout: 0,
keepAliveTimeout: 0,
- connectionsCheckingInterval: common.platformTimeout(250),
+ connectionsCheckingInterval: headersTimeout / 4,
}, common.mustCallAtLeast((req, res) => {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end();
@@ -60,7 +57,7 @@ server.listen(0, common.mustCall(() => {
'HTTP/1.1 200 OK'
);
- const defer = common.platformTimeout(headersTimeout * 1.5);
+ const defer = headersTimeout * 1.5;
// Wait some time to make sure headersTimeout
// does not interfere with keep alive
diff --git a/test/parallel/test-http-server-request-timeout-keepalive.js b/test/parallel/test-http-server-request-timeout-keepalive.js
index 0b8f798c3eb..2466e1ee7a9 100644
--- a/test/parallel/test-http-server-request-timeout-keepalive.js
+++ b/test/parallel/test-http-server-request-timeout-keepalive.js
@@ -14,9 +14,6 @@ function performRequestWithDelay(client, firstDelay, secondDelay, closeAfter) {
client.resume();
client.write('GET / HTTP/1.1\r\n');
- firstDelay = common.platformTimeout(firstDelay);
- secondDelay = common.platformTimeout(secondDelay);
-
setTimeout(() => {
client.write('Connection: ');
}, firstDelay).unref();
@@ -27,12 +24,12 @@ function performRequestWithDelay(client, firstDelay, secondDelay, closeAfter) {
}, firstDelay + secondDelay).unref();
}
-const requestTimeout = common.platformTimeout(1000);
+const requestTimeout = common.platformTimeout(2000);
const server = createServer({
headersTimeout: 0,
requestTimeout,
keepAliveTimeout: 0,
- connectionsCheckingInterval: common.platformTimeout(250),
+ connectionsCheckingInterval: requestTimeout / 4
}, common.mustCallAtLeast((req, res) => {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end();
@@ -58,7 +55,7 @@ server.listen(0, common.mustCall(() => {
'HTTP/1.1 200 OK'
);
- const defer = common.platformTimeout(requestTimeout * 1.5);
+ const defer = requestTimeout * 1.5;
// Wait some time to make sure requestTimeout
// does not interfere with keep alive