Skip to content

Commit

Permalink
test: reduce flakiness of parallel/test-http-remove-header-stays-remo…
Browse files Browse the repository at this point in the history
…ved.js

Refs: nodejs/reliability#508
Refs: #46333
  • Loading branch information
debadree25 committed Feb 27, 2023
1 parent fadcee7 commit 2c2b37c
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions test/parallel/test-http-remove-header-stays-removed.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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);
});
});

0 comments on commit 2c2b37c

Please sign in to comment.