Skip to content

Commit 323f8a7

Browse files
committed
test: readd handle reuse tests
Signed-off-by: Darshan Sen <[email protected]>
1 parent 9d8b234 commit 323f8a7

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

test/async-hooks/test-http-agent-handle-reuse-parallel.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ const common = require('../common');
44
const initHooks = require('./init-hooks');
55
const { checkInvocations } = require('./hook-checks');
66
const assert = require('assert');
7-
const { async_id_symbol } = require('internal/async_hooks').symbols;
7+
const {
8+
async_id_symbol,
9+
owner_symbol,
10+
} = require('internal/async_hooks').symbols;
811
const http = require('http');
912

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

8790
// Verify reuse handle has been wrapped
8891
assert.strictEqual(first.type, second.type);
89-
assert.ok(first.handle !== second.handle, 'Resource reused');
92+
assert.ok(first.handle[owner_symbol].handle !== second.handle,
93+
'Resource reused');
94+
assert.ok(first.handle[owner_symbol].handle === second.handle.handle,
95+
'Resource not wrapped correctly');
9096
}

test/async-hooks/test-http-agent-handle-reuse-serial.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ const common = require('../common');
44
const initHooks = require('./init-hooks');
55
const { checkInvocations } = require('./hook-checks');
66
const assert = require('assert');
7-
const { async_id_symbol } = require('internal/async_hooks').symbols;
7+
const {
8+
async_id_symbol,
9+
owner_symbol,
10+
} = require('internal/async_hooks').symbols;
811
const http = require('http');
912

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

105108
// Verify reuse handle has been wrapped
106109
assert.strictEqual(first.type, second.type);
107-
assert.ok(first.handle !== second.handle, 'Resource reused');
110+
assert.ok(first.handle[owner_symbol].handle !== second.handle,
111+
'Resource reused');
112+
assert.ok(first.handle[owner_symbol].handle === second.handle.handle,
113+
'Resource not wrapped correctly');
108114
}

0 commit comments

Comments
 (0)