Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: split out http2 from test-stream-pipeline #24631

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions test/parallel/test-stream-pipeline-http2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
'use strict';

const common = require('../common');
if (!common.hasCrypto)
common.skip('missing crypto');
const { Readable, pipeline } = require('stream');
const http2 = require('http2');

{
const server = http2.createServer((req, res) => {
pipeline(req, res, common.mustCall());
});

server.listen(0, () => {
const url = `http://localhost:${server.address().port}`;
const client = http2.connect(url);
const req = client.request({ ':method': 'POST' });

const rs = new Readable({
read() {
rs.push('hello');
}
});

pipeline(rs, req, common.mustCall((err) => {
server.close();
client.close();
}));

let cnt = 10;
req.on('data', (data) => {
cnt--;
if (cnt === 0) rs.destroy();
});
});
}
32 changes: 0 additions & 32 deletions test/parallel/test-stream-pipeline.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
'use strict';

const common = require('../common');
if (!common.hasCrypto)
common.skip('missing crypto');
const { Stream, Writable, Readable, Transform, pipeline } = require('stream');
const assert = require('assert');
const http = require('http');
const http2 = require('http2');
const { promisify } = require('util');

{
Expand Down Expand Up @@ -275,35 +272,6 @@ const { promisify } = require('util');
});
}

{
const server = http2.createServer((req, res) => {
pipeline(req, res, common.mustCall());
});

server.listen(0, () => {
const url = `http://localhost:${server.address().port}`;
const client = http2.connect(url);
const req = client.request({ ':method': 'POST' });

const rs = new Readable({
read() {
rs.push('hello');
}
});

pipeline(rs, req, common.mustCall((err) => {
server.close();
client.close();
}));

let cnt = 10;
req.on('data', (data) => {
cnt--;
if (cnt === 0) rs.destroy();
});
});
}

{
const makeTransform = () => {
const tr = new Transform({
Expand Down