-
Notifications
You must be signed in to change notification settings - Fork 5k
diagnostics_channel: vendor the two http channel tests (+2) #34641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
cirospaciari
merged 6 commits into
claude/diagnostics-channel-node26
from
claude/dc-http-channel-tests
Jul 23, 2026
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
880d1d1
diagnostics_channel: vendor the two http channel tests from Node v26.3.0
cirospaciari 95f3553
test: quarantine worker-terminate ASAN crashes, matching main
cirospaciari e30db65
test: mark no-orphans flaky on macOS
cirospaciari ddfb3d3
test: drop the branch-local darwin no-orphans quarantine
cirospaciari ba33a8b
test: sync expectations.txt with main
cirospaciari 9246cb9
Merge branch 'claude/diagnostics-channel-node26' into claude/dc-http-…
cirospaciari File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
test/js/node/test/parallel/test-diagnostic-channel-http-response-created.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| 'use strict'; | ||
| const common = require('../common'); | ||
| const assert = require('assert'); | ||
| const http = require('http'); | ||
| const dc = require('diagnostics_channel'); | ||
|
|
||
| const isOutgoingMessage = (object) => object instanceof http.OutgoingMessage; | ||
| const isIncomingMessage = (object) => object instanceof http.IncomingMessage; | ||
|
|
||
| dc.subscribe('http.server.response.created', common.mustCall(({ | ||
| request, | ||
| response, | ||
| }) => { | ||
| assert.strictEqual(request.headers.foo, 'bar'); | ||
| assert.strictEqual(response.getHeader('baz'), undefined); | ||
| assert.strictEqual(isIncomingMessage(request), true); | ||
| assert.strictEqual(isOutgoingMessage(response), true); | ||
| })); | ||
|
|
||
| dc.subscribe('http.server.response.finish', common.mustCall(({ | ||
| request, | ||
| response, | ||
| }) => { | ||
| assert.strictEqual(request.headers.foo, 'bar'); | ||
| assert.strictEqual(response.getHeader('baz'), 'bar'); | ||
| assert.strictEqual(isIncomingMessage(request), true); | ||
| assert.strictEqual(isOutgoingMessage(response), true); | ||
| })); | ||
|
|
||
| const server = http.createServer(common.mustCall((_, res) => { | ||
| res.setHeader('baz', 'bar'); | ||
| res.end('done'); | ||
| })); | ||
|
|
||
| server.listen(common.mustCall(() => { | ||
| const { port } = server.address(); | ||
| http.get({ | ||
| port, | ||
| headers: { | ||
| 'foo': 'bar', | ||
| } | ||
| }, common.mustCall(() => { | ||
| server.close(); | ||
| })); | ||
| })); |
87 changes: 87 additions & 0 deletions
87
test/js/node/test/parallel/test-diagnostics-channel-http.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| 'use strict'; | ||
| const common = require('../common'); | ||
| const { addresses } = require('../common/internet'); | ||
| const assert = require('assert'); | ||
| const http = require('http'); | ||
| const net = require('net'); | ||
| const dc = require('diagnostics_channel'); | ||
|
|
||
| const isHTTPServer = (server) => server instanceof http.Server; | ||
| const isIncomingMessage = (object) => object instanceof http.IncomingMessage; | ||
| const isOutgoingMessage = (object) => object instanceof http.OutgoingMessage; | ||
| const isNetSocket = (socket) => socket instanceof net.Socket; | ||
| const isError = (error) => error instanceof Error; | ||
|
|
||
| dc.subscribe('http.client.request.start', common.mustCall(({ request }) => { | ||
| assert.strictEqual(isOutgoingMessage(request), true); | ||
| }, 2)); | ||
|
|
||
| dc.subscribe('http.client.request.error', common.mustCall(({ request, error }) => { | ||
| assert.strictEqual(isOutgoingMessage(request), true); | ||
| assert.strictEqual(isError(error), true); | ||
| })); | ||
|
|
||
| dc.subscribe('http.client.response.finish', common.mustCall(({ | ||
| request, | ||
| response | ||
| }) => { | ||
| assert.strictEqual(isOutgoingMessage(request), true); | ||
| assert.strictEqual(isIncomingMessage(response), true); | ||
| })); | ||
|
|
||
| dc.subscribe('http.server.request.start', common.mustCall(({ | ||
| request, | ||
| response, | ||
| socket, | ||
| server, | ||
| }) => { | ||
| assert.strictEqual(isIncomingMessage(request), true); | ||
| assert.strictEqual(isOutgoingMessage(response), true); | ||
| assert.strictEqual(isNetSocket(socket), true); | ||
| assert.strictEqual(isHTTPServer(server), true); | ||
| })); | ||
|
|
||
| dc.subscribe('http.server.response.finish', common.mustCall(({ | ||
| request, | ||
| response, | ||
| socket, | ||
| server, | ||
| }) => { | ||
| assert.strictEqual(isIncomingMessage(request), true); | ||
| assert.strictEqual(isOutgoingMessage(response), true); | ||
| assert.strictEqual(isNetSocket(socket), true); | ||
| assert.strictEqual(isHTTPServer(server), true); | ||
| })); | ||
|
|
||
| dc.subscribe('http.server.response.created', common.mustCall(({ | ||
| request, | ||
| response, | ||
| }) => { | ||
| assert.strictEqual(isIncomingMessage(request), true); | ||
| assert.strictEqual(isOutgoingMessage(response), true); | ||
| })); | ||
|
|
||
| dc.subscribe('http.client.request.created', common.mustCall(({ request }) => { | ||
| assert.strictEqual(isOutgoingMessage(request), true); | ||
| assert.strictEqual(isHTTPServer(server), true); | ||
| }, 2)); | ||
|
|
||
| const server = http.createServer(common.mustCall((req, res) => { | ||
| res.end('done'); | ||
| })); | ||
|
|
||
| server.listen(async () => { | ||
| const { port } = server.address(); | ||
| const invalidRequest = http.get({ | ||
| host: addresses.INVALID_HOST, | ||
| }); | ||
| await new Promise((resolve) => { | ||
| invalidRequest.on('error', resolve); | ||
| }); | ||
| http.get(`http://localhost:${port}`, (res) => { | ||
| res.resume(); | ||
| res.on('end', () => { | ||
| server.close(); | ||
| }); | ||
| }); | ||
| }); | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.