mirror of
https://github.com/nodejs/node.git
synced 2026-10-28 18:25:13 +08:00
Native debug writes can be lost when the non-blocking stderr pipe fills, leaving expected log lines missing even when the child exits successfully. Capture stderr in a temporary file and apply the existing assertions to its contents. Remove the flaky designation on Linux s390x. Fixes: https://github.com/nodejs/node/issues/58353 Signed-off-by: Filip Skokan <panva.ip@gmail.com> Assisted-by: Codex PR-URL: https://github.com/nodejs/node/pull/66151 Fixes: https://github.com/nodejs/node/issues/52690 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com> Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Richard Lau <richard.lau@ibm.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
42 lines
1.6 KiB
JavaScript
42 lines
1.6 KiB
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
if (!common.hasCrypto)
|
|
common.skip('missing crypto');
|
|
const assert = require('assert');
|
|
const { spawnSyncAndAssert } = require('../common/child_process');
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
const tmpdir = require('../common/tmpdir');
|
|
|
|
tmpdir.refresh();
|
|
const stderrFile = tmpdir.resolve('stderr.log');
|
|
// Native debug writes can be lost when a non-blocking stderr pipe fills.
|
|
const stderrFd = fs.openSync(stderrFile, 'w');
|
|
try {
|
|
spawnSyncAndAssert(process.execPath, [
|
|
path.resolve(__dirname, 'test-http2-ping.js'),
|
|
], {
|
|
env: {
|
|
...process.env,
|
|
NODE_DEBUG: 'http2',
|
|
NODE_DEBUG_NATIVE: 'http2',
|
|
},
|
|
stdio: ['pipe', 'pipe', stderrFd],
|
|
}, {
|
|
stdout: ''
|
|
});
|
|
} finally {
|
|
fs.closeSync(stderrFd);
|
|
}
|
|
|
|
const output = fs.readFileSync(stderrFile, 'utf8');
|
|
assert.match(output,
|
|
/Setting the NODE_DEBUG environment variable to 'http2' can expose sensitive data/);
|
|
assert.match(output, /\(such as passwords, tokens and authentication headers\) in the resulting log\.\r?\n/);
|
|
assert.match(output, /Http2Session client \(\d+\) handling data frame for stream \d+\r?\n/);
|
|
assert.match(output, /HttpStream \d+ \(\d+\) \[Http2Session client \(\d+\)\] reading starting\r?\n/);
|
|
assert.match(output, /HttpStream \d+ \(\d+\) \[Http2Session client \(\d+\)\] closed with code 0\r?\n/);
|
|
assert.match(output, /HttpStream \d+ \(\d+\) \[Http2Session server \(\d+\)\] closed with code 0\r?\n/);
|
|
assert.match(output, /HttpStream \d+ \(\d+\) \[Http2Session server \(\d+\)\] tearing down stream\r?\n/);
|