From e0e39c6e164908277dafa34da67ad4c74bb9d5b0 Mon Sep 17 00:00:00 2001 From: Debadree Chatterjee Date: Mon, 27 Feb 2023 12:51:29 +0530 Subject: [PATCH 1/2] test: reduce flakiness of test-http-remove-header-stays-removed.js Refs: https://github.com/nodejs/reliability/issues/508 Refs: https://github.com/nodejs/node/pull/46333 --- .../test-http-remove-header-stays-removed.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/test/parallel/test-http-remove-header-stays-removed.js b/test/parallel/test-http-remove-header-stays-removed.js index 92c1e45dd25d01..8073c94fcbc270 100644 --- a/test/parallel/test-http-remove-header-stays-removed.js +++ b/test/parallel/test-http-remove-header-stays-removed.js @@ -20,7 +20,7 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); const http = require('http'); @@ -54,13 +54,14 @@ server.listen(0, function() { res.setEncoding('ascii'); res.on('data', function(chunk) { response += chunk; + if (response?.toString() === 'beep boop\n') { + setTimeout(function() { + // The socket should be closed immediately, with no keep-alive, because + // no content-length or transfer-encoding are used: + assert.strictEqual(res.socket.closed, true); + server.close(); + }, common.platformTimeout(15)); + } }); - - setTimeout(function() { - // The socket should be closed immediately, with no keep-alive, because - // no content-length or transfer-encoding are used: - assert.strictEqual(res.socket.closed, true); - server.close(); - }, 10); }); }); From 8a34390593bc19eb22d1b30a75607e9fe8b05325 Mon Sep 17 00:00:00 2001 From: Debadree Chatterjee Date: Mon, 13 Mar 2023 15:55:55 +0530 Subject: [PATCH 2/2] Update test/parallel/test-http-remove-header-stays-removed.js Co-authored-by: Matteo Collina --- test/parallel/test-http-remove-header-stays-removed.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-http-remove-header-stays-removed.js b/test/parallel/test-http-remove-header-stays-removed.js index 8073c94fcbc270..17e9db976c099a 100644 --- a/test/parallel/test-http-remove-header-stays-removed.js +++ b/test/parallel/test-http-remove-header-stays-removed.js @@ -54,7 +54,7 @@ server.listen(0, function() { res.setEncoding('ascii'); res.on('data', function(chunk) { response += chunk; - if (response?.toString() === 'beep boop\n') { + if (response === 'beep boop\n') { setTimeout(function() { // The socket should be closed immediately, with no keep-alive, because // no content-length or transfer-encoding are used: