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 <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
  • Loading branch information
trivikr authored and MylesBorins committed Aug 16, 2018
1 parent a1902ca commit cd44b82
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 cd44b82

Please sign in to comment.