test: http2 client operations after destroy

PR-URL: https://github.com/nodejs/node/pull/18845
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
Trivikram authored and Myles Borins committed 2018-02-21 18:12:37 -05:00
1 parent e1f82735fe
commit f90490d475
1 file changed
+8 -3
+8 -3
View File
@@ -59,7 +59,6 @@ const Countdown = require('../common/countdown');
assert(socket.destroyed);
}));
const req = client.request();
req.on('error', common.expectsError({
code: 'ERR_HTTP2_STREAM_CANCEL',
@@ -77,15 +76,21 @@ const Countdown = require('../common/countdown');
message: 'The session has been destroyed'
};
common.expectsError(() => client.request(), sessionError);
common.expectsError(() => client.setNextStreamID(), sessionError);
common.expectsError(() => client.ping(), sessionError);
common.expectsError(() => client.settings({}), sessionError);
common.expectsError(() => client.goaway(), sessionError);
common.expectsError(() => client.request(), sessionError);
client.close(); // should be a non-op at this point
// Wait for setImmediate call from destroy() to complete
// so that state.destroyed is set to true
setImmediate(() => {
common.expectsError(() => client.request(), sessionError);
common.expectsError(() => client.setNextStreamID(), sessionError);
common.expectsError(() => client.ping(), sessionError);
common.expectsError(() => client.settings({}), sessionError);
common.expectsError(() => client.goaway(), sessionError);
common.expectsError(() => client.request(), sessionError);
client.close(); // should be a non-op at this point
});