-
Notifications
You must be signed in to change notification settings - Fork 30k
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
test: refactor test-http-agent-timeout-option #25854
Conversation
Fix flakyness caused by usage of a non-routable IP address. Refs: nodejs#25488 (comment)
Resume Build CI: https://ci.nodejs.org/job/node-test-pull-request/20533/ 🤘 |
Would like to fast-track this since it's fixing a flaky test. (Just got it myself in https://ci.nodejs.org/job/node-test-binary-arm/5905/RUN_SUBSET=4,label=pi2-docker/console.) Please 👍 here to fast-track. |
Landed in 988482e |
Fix flakyness caused by usage of a non-routable IP address. Refs: nodejs#25488 (comment) PR-URL: nodejs#25854 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]>
Was writing a simpler version without establishing a TCP connection but I did not make it in time. 'use strict';
const { mustCall } = require('../common');
const { strictEqual } = require('assert');
const { Agent, get } = require('http');
// Test that the listener that forwards the `'timeout'` event from the socket to
// the `ClientRequest` instance is added to the socket when the `timeout` option
// of the `Agent` is set.
const request = get({
agent: new Agent({ timeout: 50 }),
lookup: () => {}
});
request.on('socket', mustCall((socket) => {
strictEqual(socket.timeout, 50);
const listeners = socket.listeners('timeout');
strictEqual(listeners.length, 1);
strictEqual(listeners[0], request.timeoutCb);
})); @Trott @gireeshpunathil what you think, does it worth to effort to refactor it again? |
this looks good, but given the premise is CI stability and that is established with the one that is landed may be leave it at that, visit again if it flakes? |
Yes, the only reason was to make it faster, no need to wait 500 ms or whatever the the timeout is, it should only test that the listener is added. |
Fix flakyness caused by usage of a non-routable IP address. Refs: #25488 (comment) PR-URL: #25854 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]>
Fix flakyness caused by usage of a non-routable IP address.
Refs: #25488 (comment)
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes