Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b407060

Browse filesBrowse files
Trottcodebytere
authored andcommitted
test: fix flaky test-http2-settings-flood
The test is unreliable on some Windows platforms in its current form. Make it more robust by using `setInterval()` to repeat the flooding until an error is triggered. Fixes: #18251 PR-URL: #19349 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
1 parent 9e8f4e5 commit b407060
Copy full SHA for b407060

File tree

Expand file treeCollapse file tree

2 files changed

+15
-11
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+15
-11
lines changed
Open diff view settings
Collapse file

‎test/sequential/sequential.status‎

Copy file name to clipboardExpand all lines: test/sequential/sequential.status
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ test-inspector-debug-end : PASS, FLAKY
1414
test-inspector-async-hook-setup-at-signal: PASS, FLAKY
1515
test-inspector-stop-profile-after-done: PASS, FLAKY
1616
test-http2-ping-flood : PASS, FLAKY
17-
test-http2-settings-flood : PASS, FLAKY
1817

1918
[$system==linux]
2019

Collapse file

‎test/sequential/test-http2-settings-flood.js‎

Copy file name to clipboardExpand all lines: test/sequential/test-http2-settings-flood.js
+15-10Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ const common = require('../common');
44
if (!common.hasCrypto)
55
common.skip('missing crypto');
66

7+
const assert = require('assert');
78
const http2 = require('http2');
89
const net = require('net');
10+
911
const http2util = require('../common/http2');
1012

1113
// Test that settings flooding causes the session to be torn down
@@ -14,13 +16,16 @@ const kSettings = new http2util.SettingsFrame();
1416

1517
const server = http2.createServer();
1618

19+
let interval;
20+
1721
server.on('stream', common.mustNotCall());
1822
server.on('session', common.mustCall((session) => {
19-
session.on('error', common.expectsError({
20-
code: 'ERR_HTTP2_ERROR',
21-
message:
22-
'Flooding was detected in this HTTP/2 session, and it must be closed'
23-
}));
23+
session.on('error', (e) => {
24+
assert.strictEqual(e.code, 'ERR_HTTP2_ERROR');
25+
assert(e.message.includes('Flooding was detected'));
26+
clearInterval(interval);
27+
});
28+
2429
session.on('close', common.mustCall(() => {
2530
server.close();
2631
}));
@@ -30,18 +35,18 @@ server.listen(0, common.mustCall(() => {
3035
const client = net.connect(server.address().port);
3136

3237
// nghttp2 uses a limit of 10000 items in it's outbound queue.
33-
// If this number is exceeded, a flooding error is raised. Set
34-
// this lim higher to account for the ones that nghttp2 is
35-
// successfully able to respond to.
38+
// If this number is exceeded, a flooding error is raised.
3639
// TODO(jasnell): Unfortunately, this test is inherently flaky because
3740
// it is entirely dependent on how quickly the server is able to handle
3841
// the inbound frames and whether those just happen to overflow nghttp2's
3942
// outbound queue. The threshold at which the flood error occurs can vary
4043
// from one system to another, and from one test run to another.
4144
client.on('connect', common.mustCall(() => {
4245
client.write(http2util.kClientMagic, () => {
43-
for (let n = 0; n < 35000; n++)
44-
client.write(kSettings.data);
46+
interval = setInterval(() => {
47+
for (let n = 0; n < 10000; n++)
48+
client.write(kSettings.data);
49+
}, 1);
4550
});
4651
}));
4752

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.