Skip to content

Commit 7b7687e

Browse files
lpincatargos
authored andcommittedOct 2, 2024
test: remove dead code in test-http2-misbehaving-multiplex
PR-URL: #54860 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: LiviaMedeiros <livia@cirno.name> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
1 parent 60f5f54 commit 7b7687e

File tree

1 file changed

+7
-24
lines changed

1 file changed

+7
-24
lines changed
 

‎test/parallel/test-http2-misbehaving-multiplex.js

+7-24
Original file line numberDiff line numberDiff line change
@@ -11,35 +11,18 @@ const h2 = require('http2');
1111
const net = require('net');
1212
const { NghttpError } = require('internal/http2/util');
1313
const h2test = require('../common/http2');
14-
let client;
1514

1615
const server = h2.createServer();
17-
let gotFirstStreamId1;
1816
server.on('stream', common.mustCall((stream) => {
1917
stream.respond();
2018
stream.end('ok');
2119

22-
// Http2Server should be fast enough to respond to and close
23-
// the first streams with ID 1 and ID 3 without errors.
24-
25-
// Test for errors in 'close' event to ensure no errors on some streams.
26-
stream.on('error', () => {});
27-
stream.on('close', (err) => {
28-
if (stream.id === 1) {
29-
if (gotFirstStreamId1) {
30-
// We expect our outgoing frames to fail on Stream ID 1 the second time
31-
// because a stream with ID 1 was already closed before.
32-
common.expectsError({
33-
constructor: NghttpError,
34-
code: 'ERR_HTTP2_ERROR',
35-
message: 'Stream was already closed or invalid'
36-
});
37-
return;
38-
}
39-
gotFirstStreamId1 = true;
40-
}
41-
assert.strictEqual(err, undefined);
42-
});
20+
stream.on('error', common.expectsError({
21+
code: 'ERR_HTTP2_ERROR',
22+
constructor: NghttpError,
23+
message: 'Stream was already closed or invalid'
24+
}));
25+
stream.on('close', common.mustCall());
4326

4427
// Stream ID 5 should never reach the server
4528
assert.notStrictEqual(stream.id, 5);
@@ -62,7 +45,7 @@ const id3 = new h2test.HeadersFrame(3, h2test.kFakeRequestHeaders, 0, true);
6245
const id5 = new h2test.HeadersFrame(5, h2test.kFakeRequestHeaders, 0, true);
6346

6447
server.listen(0, () => {
65-
client = net.connect(server.address().port, () => {
48+
const client = net.connect(server.address().port, () => {
6649
client.write(h2test.kClientMagic, () => {
6750
client.write(settings.data, () => {
6851
client.write(settingsAck.data);

0 commit comments

Comments
 (0)
Please sign in to comment.