GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: fix flaky test-http2-client-upload · nodejs/node@2a2fe8a

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test/parallel
    • test-http2-client-upload.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/parallel/test-http2-client-upload.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-http2-client-upload.js
+11-6Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,29 @@ fs.readFile(loc, common.mustCall((err, data) => {
2121
fileData = data;
2222

2323
const server = http2.createServer();
24+
let client;
25+
26+
const countdown = new Countdown(3, () => {
27+
server.close();
28+
client.close();
29+
});
2430

2531
server.on('stream', common.mustCall((stream) => {
2632
let data = Buffer.alloc(0);
2733
stream.on('data', (chunk) => data = Buffer.concat([data, chunk]));
2834
stream.on('end', common.mustCall(() => {
2935
assert.deepStrictEqual(data, fileData);
3036
}));
37+
// Waiting on close avoids spurious ECONNRESET seen in windows CI.
38+
// Not sure if this is actually a bug; more details at
39+
// https://github.com/nodejs/node/issues/20750#issuecomment-511015247
40+
stream.on('close', () => countdown.dec());
3141
stream.respond();
3242
stream.end();
3343
}));
3444

3545
server.listen(0, common.mustCall(() => {
36-
const client = http2.connect(`http://localhost:${server.address().port}`);
37-
38-
const countdown = new Countdown(2, () => {
39-
server.close();
40-
client.close();
41-
});
46+
client = http2.connect(`http://localhost:${server.address().port}`);
4247

4348
const req = client.request({ ':method': 'POST' });
4449
req.on('response', common.mustCall());

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.