test: fix flaky cleanup in http2 test

Signed-off-by: Tim Perry <pimterry@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/65701
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
Tim Perry authored and Antoine du Hamel committed 2026-09-16 20:29:06 +02:00
1 parent 7a3437d998
commit 75a9fa65ac
1 file changed
+4 -2
@@ -38,6 +38,7 @@ class StalledClientSocket extends Duplex {
super();
this.inner = net.connect(port, common.localhostIPv4);
this.inner.on('data', (chunk) => this.push(chunk));
this.inner.on('end', () => this.push(null));
}
_read() {
// Incoming data is pushed as it arrives.
@@ -54,7 +55,7 @@ class StalledClientSocket extends Duplex {
callback();
}
_final(callback) {
callback();
this.inner.end(callback);
}
_destroy(err, callback) {
this.inner.destroy();
@@ -101,7 +102,8 @@ server.listen(0, common.mustCall(() => {
stallWrites = false;
for (const callback of heldCallbacks) callback();
client.destroy();
req.end();
client.close();
server.close();
}));
}));