Skip to content

Commit

Permalink
test: readd handle reuse tests
Browse files Browse the repository at this point in the history
Signed-off-by: Darshan Sen <darshan.sen@postman.com>
  • Loading branch information
RaisinTen committed Nov 11, 2021
1 parent 9d8b234 commit 323f8a7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
10 changes: 8 additions & 2 deletions test/async-hooks/test-http-agent-handle-reuse-parallel.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ const common = require('../common');
const initHooks = require('./init-hooks');
const { checkInvocations } = require('./hook-checks');
const assert = require('assert');
const { async_id_symbol } = require('internal/async_hooks').symbols;
const {
async_id_symbol,
owner_symbol,
} = require('internal/async_hooks').symbols;
const http = require('http');

// Checks that the async resource used in init in case of a reused handle
Expand Down Expand Up @@ -86,5 +89,8 @@ function onExit() {

// Verify reuse handle has been wrapped
assert.strictEqual(first.type, second.type);
assert.ok(first.handle !== second.handle, 'Resource reused');
assert.ok(first.handle[owner_symbol].handle !== second.handle,
'Resource reused');
assert.ok(first.handle[owner_symbol].handle === second.handle.handle,
'Resource not wrapped correctly');
}
10 changes: 8 additions & 2 deletions test/async-hooks/test-http-agent-handle-reuse-serial.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ const common = require('../common');
const initHooks = require('./init-hooks');
const { checkInvocations } = require('./hook-checks');
const assert = require('assert');
const { async_id_symbol } = require('internal/async_hooks').symbols;
const {
async_id_symbol,
owner_symbol,
} = require('internal/async_hooks').symbols;
const http = require('http');

// Checks that the async resource used in init in case of a reused handle
Expand Down Expand Up @@ -104,5 +107,8 @@ function onExit() {

// Verify reuse handle has been wrapped
assert.strictEqual(first.type, second.type);
assert.ok(first.handle !== second.handle, 'Resource reused');
assert.ok(first.handle[owner_symbol].handle !== second.handle,
'Resource reused');
assert.ok(first.handle[owner_symbol].handle === second.handle.handle,
'Resource not wrapped correctly');
}

0 comments on commit 323f8a7

Please sign in to comment.