diff --git a/test/cctest/test_node_crypto.cc b/test/cctest/test_node_crypto.cc index 66e31941fc477c..bb841b8690de68 100644 --- a/test/cctest/test_node_crypto.cc +++ b/test/cctest/test_node_crypto.cc @@ -21,30 +21,3 @@ TEST(NodeCrypto, NewRootCertStore) { "any errors on the OpenSSL error stack\n"; X509_STORE_free(store); } - -/* - * This test verifies that OpenSSL memory tracking constants are properly - * defined. - */ -TEST(NodeCrypto, MemoryTrackingConstants) { - // Verify that our memory tracking constants are defined and reasonable - EXPECT_GT(node::crypto::kSizeOf_SSL_CTX, 0) - << "SSL_CTX size constant should be positive"; - EXPECT_GT(node::crypto::kSizeOf_X509, 0) - << "X509 size constant should be positive"; - EXPECT_GT(node::crypto::kSizeOf_EVP_MD_CTX, 0) - << "EVP_MD_CTX size constant should be positive"; - - // Verify reasonable size ranges (basic sanity check) - EXPECT_LT(node::crypto::kSizeOf_SSL_CTX, 10000) - << "SSL_CTX size should be reasonable"; - EXPECT_LT(node::crypto::kSizeOf_X509, 10000) - << "X509 size should be reasonable"; - EXPECT_LT(node::crypto::kSizeOf_EVP_MD_CTX, 1000) - << "EVP_MD_CTX size should be reasonable"; - - // Specific values we expect based on our implementation - EXPECT_EQ(node::crypto::kSizeOf_SSL_CTX, 240); - EXPECT_EQ(node::crypto::kSizeOf_X509, 128); - EXPECT_EQ(node::crypto::kSizeOf_EVP_MD_CTX, 48); -} diff --git a/test/pummel/test-heapdump-secure-context.js b/test/pummel/test-heapdump-secure-context.js new file mode 100644 index 00000000000000..d8b27db06fdba4 --- /dev/null +++ b/test/pummel/test-heapdump-secure-context.js @@ -0,0 +1,31 @@ +'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 { validateByRetainingPath } = require('../common/heap'); +const tls = require('tls'); + +{ + const nodes = validateByRetainingPath('Node / SecureContext', []); + assert.strictEqual(nodes.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'), +}); + +validateByRetainingPath('Node / SecureContext', [ + { edge_name: 'ctx', node_name: 'Node / ctx' }, +]); + +validateByRetainingPath('Node / SecureContext', [ + { edge_name: 'cert', node_name: 'Node / cert' }, +]);