diff --git a/test/cctest/test_node_crypto.cc b/test/cctest/test_node_crypto.cc index 94940e3c55f939..0f116726fcb64d 100644 --- a/test/cctest/test_node_crypto.cc +++ b/test/cctest/test_node_crypto.cc @@ -25,33 +25,6 @@ TEST(NodeCrypto, NewRootCertStore) { 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, static_cast(0)) - << "SSL_CTX size constant should be positive"; - EXPECT_GT(node::crypto::kSizeOf_X509, static_cast(0)) - << "X509 size constant should be positive"; - EXPECT_GT(node::crypto::kSizeOf_EVP_MD_CTX, static_cast(0)) - << "EVP_MD_CTX size constant should be positive"; - - // Verify reasonable size ranges (basic sanity check) - EXPECT_LT(node::crypto::kSizeOf_SSL_CTX, static_cast(10000)) - << "SSL_CTX size should be reasonable"; - EXPECT_LT(node::crypto::kSizeOf_X509, static_cast(10000)) - << "X509 size should be reasonable"; - EXPECT_LT(node::crypto::kSizeOf_EVP_MD_CTX, static_cast(1000)) - << "EVP_MD_CTX size should be reasonable"; - - // Specific values we expect based on our implementation - EXPECT_EQ(node::crypto::kSizeOf_SSL_CTX, static_cast(240)); - EXPECT_EQ(node::crypto::kSizeOf_X509, static_cast(128)); - EXPECT_EQ(node::crypto::kSizeOf_EVP_MD_CTX, static_cast(48)); -} - TEST(NodeCrypto, TryGetIntCipherOutputLength) { int output_len = 0; diff --git a/test/pummel/test-heapdump-secure-context.js b/test/pummel/test-heapdump-secure-context.js new file mode 100644 index 00000000000000..30fb7d1a157ab9 --- /dev/null +++ b/test/pummel/test-heapdump-secure-context.js @@ -0,0 +1,29 @@ +'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 { + createJSHeapSnapshot, + validateByRetainingPathFromNodes, +} = require('../common/heap'); +const tls = require('tls'); + +// 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' }, + ]); +}