summaryrefslogtreecommitdiff
path: root/test/parallel
diff options
context:
space:
mode:
Diffstat (limited to 'test/parallel')
-rw-r--r--test/parallel/parallel.status6
-rw-r--r--test/parallel/test-http2-client-destroy.js8
-rw-r--r--test/parallel/test-http2-no-wanttrailers-listener.js5
-rw-r--r--test/parallel/test-http2-server-close-callback.js19
-rw-r--r--test/parallel/test-http2-server-sessionerror.js13
-rw-r--r--test/parallel/test-http2-server-shutdown-options-errors.js6
-rw-r--r--test/parallel/test-http2-server-socket-destroy.js10
-rw-r--r--test/parallel/test-http2-server-stream-session-destroy.js8
-rwxr-xr-xtest/parallel/test-http2-server-timeout.js10
-rw-r--r--test/parallel/test-http2-too-many-settings.js7
-rw-r--r--test/parallel/test-http2-trailers.js3
11 files changed, 36 insertions, 59 deletions
diff --git a/test/parallel/parallel.status b/test/parallel/parallel.status
index 2bd5db8388..899e6adfac 100644
--- a/test/parallel/parallel.status
+++ b/test/parallel/parallel.status
@@ -8,12 +8,6 @@ prefix parallel
# Postmortem debugging data is prone to accidental removal during V8 updates.
test-postmortem-metadata: PASS,FLAKY
-# http2 has a few bugs that make these tests flaky and that are currently worked
-# on.
-test-http2-client-upload-reject: PASS,FLAKY
-test-http2-pipe: PASS,FLAKY
-test-http2-client-upload: PASS,FLAKY
-
[$system==win32]
[$system==linux]
diff --git a/test/parallel/test-http2-client-destroy.js b/test/parallel/test-http2-client-destroy.js
index 6238363511..43fc6819e2 100644
--- a/test/parallel/test-http2-client-destroy.js
+++ b/test/parallel/test-http2-client-destroy.js
@@ -109,9 +109,6 @@ const Countdown = require('../common/countdown');
server.listen(0, common.mustCall(() => {
const client = h2.connect(`http://localhost:${server.address().port}`);
- // On some platforms (e.g. windows), an ECONNRESET may occur at this
- // point -- or it may not. Do not make this a mustCall
- client.on('error', () => {});
client.on('close', () => {
server.close();
@@ -119,10 +116,7 @@ const Countdown = require('../common/countdown');
client.destroy();
});
- const req = client.request();
- // On some platforms (e.g. windows), an ECONNRESET may occur at this
- // point -- or it may not. Do not make this a mustCall
- req.on('error', () => {});
+ client.request();
}));
}
diff --git a/test/parallel/test-http2-no-wanttrailers-listener.js b/test/parallel/test-http2-no-wanttrailers-listener.js
index 7ba25d0e49..87bc21df48 100644
--- a/test/parallel/test-http2-no-wanttrailers-listener.js
+++ b/test/parallel/test-http2-no-wanttrailers-listener.js
@@ -3,7 +3,6 @@
const common = require('../common');
if (!common.hasCrypto)
common.skip('missing crypto');
-const assert = require('assert');
const h2 = require('http2');
const server = h2.createServer();
@@ -25,9 +24,7 @@ server.on('listening', common.mustCall(function() {
const client = h2.connect(`http://localhost:${this.address().port}`);
const req = client.request();
req.resume();
- req.on('trailers', common.mustCall((headers) => {
- assert.strictEqual(Object.keys(headers).length, 0);
- }));
+ req.on('trailers', common.mustNotCall());
req.on('close', common.mustCall(() => {
server.close();
client.close();
diff --git a/test/parallel/test-http2-server-close-callback.js b/test/parallel/test-http2-server-close-callback.js
index 66887aa62b..f822d8a4a9 100644
--- a/test/parallel/test-http2-server-close-callback.js
+++ b/test/parallel/test-http2-server-close-callback.js
@@ -4,21 +4,24 @@ const common = require('../common');
if (!common.hasCrypto)
common.skip('missing crypto');
+const Countdown = require('../common/countdown');
const http2 = require('http2');
const server = http2.createServer();
+let session;
+
+const countdown = new Countdown(2, () => {
+ server.close(common.mustCall());
+ session.destroy();
+});
+
server.listen(0, common.mustCall(() => {
const client = http2.connect(`http://localhost:${server.address().port}`);
- client.on('error', (err) => {
- if (err.code !== 'ECONNRESET')
- throw err;
- });
+ client.on('connect', common.mustCall(() => countdown.dec()));
}));
server.on('session', common.mustCall((s) => {
- setImmediate(() => {
- server.close(common.mustCall());
- s.destroy();
- });
+ session = s;
+ countdown.dec();
}));
diff --git a/test/parallel/test-http2-server-sessionerror.js b/test/parallel/test-http2-server-sessionerror.js
index 525eb2e6ef..c50352fcc3 100644
--- a/test/parallel/test-http2-server-sessionerror.js
+++ b/test/parallel/test-http2-server-sessionerror.js
@@ -35,14 +35,17 @@ server.on('session', common.mustCall((session) => {
server.listen(0, common.mustCall(() => {
const url = `http://localhost:${server.address().port}`;
http2.connect(url)
- // An ECONNRESET error may occur depending on the platform (due largely
- // to differences in the timing of socket closing). Do not wrap this in
- // a common must call.
- .on('error', () => {})
+ .on('error', common.expectsError({
+ code: 'ERR_HTTP2_SESSION_ERROR',
+ message: 'Session closed with error code 2',
+ }))
.on('close', () => {
server.removeAllListeners('error');
http2.connect(url)
- .on('error', () => {})
+ .on('error', common.expectsError({
+ code: 'ERR_HTTP2_SESSION_ERROR',
+ message: 'Session closed with error code 2',
+ }))
.on('close', () => server.close());
});
}));
diff --git a/test/parallel/test-http2-server-shutdown-options-errors.js b/test/parallel/test-http2-server-shutdown-options-errors.js
index 95849411a2..9dde6660ea 100644
--- a/test/parallel/test-http2-server-shutdown-options-errors.js
+++ b/test/parallel/test-http2-server-shutdown-options-errors.js
@@ -55,13 +55,7 @@ server.listen(
0,
common.mustCall(() => {
const client = http2.connect(`http://localhost:${server.address().port}`);
- // On certain operating systems, an ECONNRESET may occur. We do not need
- // to test for it here. Do not make this a mustCall
- client.on('error', () => {});
const req = client.request();
- // On certain operating systems, an ECONNRESET may occur. We do not need
- // to test for it here. Do not make this a mustCall
- req.on('error', () => {});
req.resume();
req.on('close', common.mustCall(() => {
client.close();
diff --git a/test/parallel/test-http2-server-socket-destroy.js b/test/parallel/test-http2-server-socket-destroy.js
index 03afc1957b..99595aeb63 100644
--- a/test/parallel/test-http2-server-socket-destroy.js
+++ b/test/parallel/test-http2-server-socket-destroy.js
@@ -41,14 +41,20 @@ server.on('listening', common.mustCall(() => {
// The client may have an ECONNRESET error here depending on the operating
// system, due mainly to differences in the timing of socket closing. Do
// not wrap this in a common mustCall.
- client.on('error', () => {});
+ client.on('error', (err) => {
+ if (err.code !== 'ECONNRESET')
+ throw err;
+ });
client.on('close', common.mustCall());
const req = client.request({ ':method': 'POST' });
// The client may have an ECONNRESET error here depending on the operating
// system, due mainly to differences in the timing of socket closing. Do
// not wrap this in a common mustCall.
- req.on('error', () => {});
+ req.on('error', (err) => {
+ if (err.code !== 'ECONNRESET')
+ throw err;
+ });
req.on('aborted', common.mustCall());
req.resume();
diff --git a/test/parallel/test-http2-server-stream-session-destroy.js b/test/parallel/test-http2-server-stream-session-destroy.js
index ef4f42fe39..6a262e2736 100644
--- a/test/parallel/test-http2-server-stream-session-destroy.js
+++ b/test/parallel/test-http2-server-stream-session-destroy.js
@@ -44,16 +44,8 @@ server.on('stream', common.mustCall((stream) => {
server.listen(0, common.mustCall(() => {
const client = h2.connect(`http://localhost:${server.address().port}`);
- client.on('error', (err) => {
- if (err.code !== 'ECONNRESET')
- throw err;
- });
const req = client.request();
req.resume();
req.on('end', common.mustCall());
req.on('close', common.mustCall(() => server.close(common.mustCall())));
- req.on('error', (err) => {
- if (err.code !== 'ECONNRESET')
- throw err;
- });
}));
diff --git a/test/parallel/test-http2-server-timeout.js b/test/parallel/test-http2-server-timeout.js
index 4410cb51c1..88fc4eab2e 100755
--- a/test/parallel/test-http2-server-timeout.js
+++ b/test/parallel/test-http2-server-timeout.js
@@ -6,10 +6,10 @@ if (!common.hasCrypto)
const http2 = require('http2');
const server = http2.createServer();
-server.setTimeout(common.platformTimeout(1));
+server.setTimeout(common.platformTimeout(50));
const onServerTimeout = common.mustCall((session) => {
- session.close(() => session.destroy());
+ session.close();
});
server.on('stream', common.mustNotCall());
@@ -18,14 +18,8 @@ server.once('timeout', onServerTimeout);
server.listen(0, common.mustCall(() => {
const url = `http://localhost:${server.address().port}`;
const client = http2.connect(url);
- // Because of the timeout, an ECONNRESET error may or may not happen here.
- // Keep this as a non-op and do not use common.mustCall()
- client.on('error', () => {});
client.on('close', common.mustCall(() => {
const client2 = http2.connect(url);
- // Because of the timeout, an ECONNRESET error may or may not happen here.
- // Keep this as a non-op and do not use common.mustCall()
- client2.on('error', () => {});
client2.on('close', common.mustCall(() => server.close()));
}));
}));
diff --git a/test/parallel/test-http2-too-many-settings.js b/test/parallel/test-http2-too-many-settings.js
index 0302fe623d..acfd73ada6 100644
--- a/test/parallel/test-http2-too-many-settings.js
+++ b/test/parallel/test-http2-too-many-settings.js
@@ -29,9 +29,10 @@ function doTest(session) {
server.listen(0, common.mustCall(() => {
const client = h2.connect(`http://localhost:${server.address().port}`);
- // On some operating systems, an ECONNRESET error may be emitted.
- // On others it won't be. Do not make this a mustCall
- client.on('error', () => {});
+ client.on('error', common.expectsError({
+ code: 'ERR_HTTP2_SESSION_ERROR',
+ message: 'Session closed with error code 2',
+ }));
client.on('close', common.mustCall(() => server.close()));
}));
}
diff --git a/test/parallel/test-http2-trailers.js b/test/parallel/test-http2-trailers.js
index 2b7f6158ca..bdc0931157 100644
--- a/test/parallel/test-http2-trailers.js
+++ b/test/parallel/test-http2-trailers.js
@@ -18,6 +18,7 @@ server.on('stream', common.mustCall(onStream));
function onStream(stream, headers, flags) {
stream.on('trailers', common.mustCall((headers) => {
assert.strictEqual(headers[trailerKey], trailerValue);
+ stream.end(body);
}));
stream.respond({
'content-type': 'text/html',
@@ -41,8 +42,6 @@ function onStream(stream, headers, flags) {
type: Error
}
);
-
- stream.end(body);
}
server.listen(0);