Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions test/cctest/test_node_crypto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
31 changes: 31 additions & 0 deletions test/pummel/test-heapdump-secure-context.js
Original file line number Diff line number Diff line change
@@ -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' },
]);
Loading