Skip to content

Commit 8b10dc3

Browse files
committed
test: use heapdump test for SecureContext memory tracking
1 parent 726b220 commit 8b10dc3

File tree

2 files changed

+21
-27
lines changed

2 files changed

+21
-27
lines changed

test/cctest/test_node_crypto.cc

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -21,30 +21,3 @@ TEST(NodeCrypto, NewRootCertStore) {
2121
"any errors on the OpenSSL error stack\n";
2222
X509_STORE_free(store);
2323
}
24-
25-
/*
26-
* This test verifies that OpenSSL memory tracking constants are properly
27-
* defined.
28-
*/
29-
TEST(NodeCrypto, MemoryTrackingConstants) {
30-
// Verify that our memory tracking constants are defined and reasonable
31-
EXPECT_GT(node::crypto::kSizeOf_SSL_CTX, 0)
32-
<< "SSL_CTX size constant should be positive";
33-
EXPECT_GT(node::crypto::kSizeOf_X509, 0)
34-
<< "X509 size constant should be positive";
35-
EXPECT_GT(node::crypto::kSizeOf_EVP_MD_CTX, 0)
36-
<< "EVP_MD_CTX size constant should be positive";
37-
38-
// Verify reasonable size ranges (basic sanity check)
39-
EXPECT_LT(node::crypto::kSizeOf_SSL_CTX, 10000)
40-
<< "SSL_CTX size should be reasonable";
41-
EXPECT_LT(node::crypto::kSizeOf_X509, 10000)
42-
<< "X509 size should be reasonable";
43-
EXPECT_LT(node::crypto::kSizeOf_EVP_MD_CTX, 1000)
44-
<< "EVP_MD_CTX size should be reasonable";
45-
46-
// Specific values we expect based on our implementation
47-
EXPECT_EQ(node::crypto::kSizeOf_SSL_CTX, 240);
48-
EXPECT_EQ(node::crypto::kSizeOf_X509, 128);
49-
EXPECT_EQ(node::crypto::kSizeOf_EVP_MD_CTX, 48);
50-
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
'use strict';
2+
// This tests heap snapshot integration of SecureContext.
3+
4+
const common = require('../common');
5+
6+
if (!common.hasCrypto)
7+
common.skip('missing crypto');
8+
9+
const { validateSnapshotNodes } = require('../common/heap');
10+
const tls = require('tls');
11+
12+
// eslint-disable-next-line no-unused-vars
13+
const ctx = tls.createSecureContext();
14+
15+
validateSnapshotNodes('Node / SecureContext', [
16+
{
17+
children: [
18+
{ edge_name: 'ctx', node_name: 'Node / ctx' },
19+
],
20+
},
21+
]);

0 commit comments

Comments
 (0)