-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
Expand file tree
/
Copy pathtest-heapdump-secure-context.js
More file actions
37 lines (31 loc) · 1.01 KB
/
test-heapdump-secure-context.js
File metadata and controls
37 lines (31 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
'use strict';
// This tests heap snapshot integration of SecureContext.
const common = require('../common');
if (!common.hasCrypto) common.skip('missing crypto');
const fixtures = require('../common/fixtures');
const assert = require('assert');
const {
createJSHeapSnapshot,
validateByRetainingPathFromNodes,
} = require('../common/heap');
const tls = require('tls');
{
const nodes = createJSHeapSnapshot();
const matches = nodes.filter(
(n) => n.name === 'Node / SecureContext' && n.type !== 'string');
assert.strictEqual(matches.length, 0);
}
// eslint-disable-next-line no-unused-vars
const ctx = tls.createSecureContext({
cert: fixtures.readKey('agent1-cert.pem'),
key: fixtures.readKey('agent1-key.pem'),
});
{
const nodes = createJSHeapSnapshot();
validateByRetainingPathFromNodes(nodes, 'Node / SecureContext', [
{ edge_name: 'ctx', node_name: 'Node / ctx' },
]);
validateByRetainingPathFromNodes(nodes, 'Node / SecureContext', [
{ edge_name: 'cert', node_name: 'Node / cert' },
]);
}