Skip to content

Commit 8806e54

Browse files
apapirovskiMylesBorins
authored andcommitted
test: fix flaky test-http-highwatermark
PR-URL: #17949 Fixes: #17857 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
1 parent 8e1011f commit 8806e54

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

test/parallel/test-http-hightwatermark.js test/parallel/test-http-highwatermark.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ let requestReceived = 0;
1414
const server = http.createServer(function(req, res) {
1515
const id = ++requestReceived;
1616
const enoughToDrain = req.connection.writableHighWaterMark;
17-
const body = 'x'.repeat(enoughToDrain);
17+
const body = 'x'.repeat(enoughToDrain * 100);
1818

1919
if (id === 1) {
2020
// Case of needParse = false
@@ -39,11 +39,11 @@ const server = http.createServer(function(req, res) {
3939
}).on('listening', () => {
4040
const c = net.createConnection(server.address().port, () => {
4141
c.write('GET / HTTP/1.1\r\n\r\n');
42-
c.write('GET / HTTP/1.1\r\n\r\n');
42+
c.write('GET / HTTP/1.1\r\n\r\n',
43+
() => setImmediate(() => c.resume()));
4344
c.end();
4445
});
4546

46-
c.on('data', () => {});
4747
c.on('end', () => {
4848
server.close();
4949
});

0 commit comments

Comments
 (0)