Commit 81f15ffaad9 for nodejs
commit 81f15ffaad97b9187b432f59b627b83d1d2ff5d8
Author: Filip Skokan <panva.ip@gmail.com>
Date: Sat Sep 26 14:20:22 2026 +0200
test: deflake inspector network fetch
A Windows socket bound to 127.0.0.1 can accept connections intended for
another process's wildcard listener on the same port. A competing
inspector can then answer the HTTP request with 400 or send plaintext
to the HTTPS client.
Bind both fixture servers to the address used by their requests to
prevent the competing bind. Bypass environment proxies so local HTTP
and HTTPS requests reach the fixture servers directly, and remove the
Windows flaky expectation.
Fixes: https://github.com/nodejs/node/issues/59090
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
Assisted-by: Claude, Codex
PR-URL: https://github.com/nodejs/node/pull/66320
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
diff --git a/test/parallel/parallel.status b/test/parallel/parallel.status
index de658a702b4..6f9ebb415a4 100644
--- a/test/parallel/parallel.status
+++ b/test/parallel/parallel.status
@@ -17,8 +17,6 @@ test-shadow-realm-gc-module: SKIP
test-snapshot-incompatible: SKIP
[$system==win32]
-# https://github.com/nodejs/node/issues/59090
-test-inspector-network-fetch: PASS, FLAKY
# https://github.com/nodejs/node/issues/59636
test-fs-cp-sync-symlink-points-to-dest-error: SKIP
test-fs-cp-async-symlink-points-to-dest: SKIP
diff --git a/test/parallel/test-inspector-network-fetch.js b/test/parallel/test-inspector-network-fetch.js
index 790446c84bf..a637d349546 100644
--- a/test/parallel/test-inspector-network-fetch.js
+++ b/test/parallel/test-inspector-network-fetch.js
@@ -12,9 +12,10 @@ const http = require('node:http');
const https = require('node:https');
const inspector = require('node:inspector/promises');
-// Disable certificate validation for the global fetch.
+// Keep local requests independent of proxy settings and allow the test certificate.
const undici = require('internal/deps/undici/undici');
undici.setGlobalDispatcher(new undici.EnvHttpProxyAgent({
+ noProxy: '*',
connect: {
rejectUnauthorized: false,
},
@@ -205,8 +206,10 @@ const testNetworkInspection = async () => {
session.removeAllListeners();
};
-httpServer.listen(0, () => {
- httpsServer.listen(0, async () => {
+// Listen on the address the requests go to, so that a socket another process
+// binds to 127.0.0.1 on the same port cannot take the connections over.
+httpServer.listen(0, '127.0.0.1', () => {
+ httpsServer.listen(0, '127.0.0.1', async () => {
try {
await session.post('Network.enable');
await testNetworkInspection();