Skip to content

Commit

Permalink
test: http2 client operations after destroy
Browse files Browse the repository at this point in the history
PR-URL: #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>
  • Loading branch information
trivikr authored and MylesBorins committed Feb 21, 2018
1 parent 88bb203 commit dbd2eb9
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions test/parallel/test-http2-client-destroy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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
});

Expand Down

0 comments on commit dbd2eb9

Please sign in to comment.