Commit 3f76564e8e6 for nodejs
commit 3f76564e8e6b0678736ced5d20363f1e8bfa8e47
Author: Filip Skokan <panva.ip@gmail.com>
Date: Sun Sep 20 09:12:14 2026 +0200
test: deflake test-http2-debug
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>
diff --git a/test/parallel/parallel.status b/test/parallel/parallel.status
index d8fba447e96..921c04d011d 100644
--- a/test/parallel/parallel.status
+++ b/test/parallel/parallel.status
@@ -35,10 +35,6 @@ test-performance-function: PASS, FLAKY
# https://github.com/nodejs/node/issues/54346
test-esm-loader-hooks-inspect-wait: PASS, FLAKY
-[$system==linux && $arch==s390x]
-# https://github.com/nodejs/node/issues/58353
-test-http2-debug: PASS, FLAKY
-
[$system==macos]
# https://github.com/nodejs/node/issues/42741
test-http-server-headers-timeout-keepalive: PASS,FLAKY
diff --git a/test/parallel/test-http2-debug.js b/test/parallel/test-http2-debug.js
index 5f2f6c54da7..c7252317be3 100644
--- a/test/parallel/test-http2-debug.js
+++ b/test/parallel/test-http2-debug.js
@@ -5,27 +5,37 @@ 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');
-spawnSyncAndAssert(process.execPath, [
- path.resolve(__dirname, 'test-http2-ping.js'),
-], {
- env: {
- ...process.env,
- NODE_DEBUG: 'http2',
- NODE_DEBUG_NATIVE: 'http2',
- },
-}, {
- trim: true,
- stderr(output) {
- 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/);
- },
- stdout: ''
-});
+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/);