test: refactor test-tls-enable-trace-cli.js
PR-URL: https://github.com/nodejs/node/pull/27553 Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
parent
a681d95a30
commit
9a174db3d8
@ -22,23 +22,24 @@ const child = fork(__filename, ['test'], {
|
||||
execArgv: ['--trace-tls']
|
||||
});
|
||||
|
||||
let stdout = '';
|
||||
let stderr = '';
|
||||
child.stdout.setEncoding('utf8');
|
||||
child.stderr.setEncoding('utf8');
|
||||
child.stdout.on('data', (data) => stdout += data);
|
||||
child.stderr.on('data', (data) => stderr += data);
|
||||
child.on('close', common.mustCall(() => {
|
||||
child.on('close', common.mustCall((code, signal) => {
|
||||
// For debugging and observation of actual trace output.
|
||||
console.log(stderr);
|
||||
|
||||
assert.strictEqual(code, 0);
|
||||
assert.strictEqual(signal, null);
|
||||
assert.strictEqual(stdout.trim(), '');
|
||||
assert(/Warning: Enabling --trace-tls can expose sensitive/.test(stderr));
|
||||
assert(/Received Record/.test(stderr));
|
||||
assert(/ClientHello/.test(stderr));
|
||||
}));
|
||||
|
||||
// For debugging and observation of actual trace output.
|
||||
child.stderr.pipe(process.stderr);
|
||||
child.stdout.pipe(process.stdout);
|
||||
|
||||
child.on('exit', common.mustCall((code) => {
|
||||
assert.strictEqual(code, 0);
|
||||
}));
|
||||
|
||||
function test() {
|
||||
const {
|
||||
connect, keys
|
||||
@ -54,6 +55,13 @@ function test() {
|
||||
key: keys.agent6.key
|
||||
},
|
||||
}, common.mustCall((err, pair, cleanup) => {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
console.error(err.opensslErrorStack);
|
||||
console.error(err.reason);
|
||||
assert(err);
|
||||
}
|
||||
|
||||
return cleanup();
|
||||
}));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user