| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
LGTM |
Sorry, something went wrong.
|
These changes mean that the test no longer triggers on the bug it was written for. This test is for a bug that was present in Node.js 3.0.0 and this version of the test (with appropriate modifications to remove fat arrows, etc. which were not supported in Node 3.0.0) does not fire an assertion whereas the current version does. For the record, here's the way it ended up after removing fat arrows, etc. so that it could run in Node 3.0.0: 'use strict';
// const common = require('../common');
const assert = require('assert');
const net = require('net');
// skip test in FreeBSD jails
// if (common.inFreeBSDJail) {
// console.log('1..0 # Skipped: In a FreeBSD jail');
// return;
// }
var conns = 0;
var clientLocalPorts = [];
var serverRemotePorts = [];
const server = net.createServer(function(socket) {
serverRemotePorts.push(socket.remotePort);
socket.end();
});
server.on('close', function() {
assert.deepEqual(clientLocalPorts, serverRemotePorts,
'client and server should agree on the ports used');
assert.strictEqual(2, conns);
});
server.listen(12346, '127.0.0.1', connect);
function connect() {
if (conns === 2) {
server.close();
return;
}
const client = new net.Socket();
conns++;
client.once('close', connect);
client.connect(12346, '127.0.0.1', function() {
clientLocalPorts.push(client.localPort);
});
}
|
Sorry, something went wrong.
|
Good catch. Simple fix, just have to move the const client = new net.Socket(); up higher so that the same socket is reused. I'll update the PR. |
Sorry, something went wrong.
Prior to this commit, the test was flaky because it was executing the majority of its logic in a function called from the client and multiple events on the server. This commit simplifies the test by separating the server's connection and listening events, and isolating the client logic.
|
@Trott updated. Verified that moving the client socket triggers the original bug in v3.0.0. |
Sorry, something went wrong.
|
Lets try it in CI: https://ci.nodejs.org/job/node-test-commit/1709/ |
Sorry, something went wrong.
|
CI has some red, but none in this test. We should probably run a stress test too. |
Sorry, something went wrong.
Sorry, something went wrong.
|
Confirmed expected test failure in Node.js 3.0.0 and success in Node.js 3.3.0. So that's good. LGTM if the stress test comes out clean. |
Sorry, something went wrong.
Prior to this commit, the test was flaky because it was executing the majority of its logic in a function called from the client and multiple events on the server. This commit simplifies the test by separating the server's connection and listening events, and isolating the client logic. Refs: #4476 Refs: #4644 PR-URL: #4650 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
|
Thanks for the review. Stress test came through green. Landed in 6cfd0b5. |
Sorry, something went wrong.
Prior to this commit, the test was flaky because it was executing the majority of its logic in a function called from the client and multiple events on the server. This commit simplifies the test by separating the server's connection and listening events, and isolating the client logic. Refs: #4476 Refs: #4644 PR-URL: #4650 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Prior to this commit, the test was flaky because it was executing the majority of its logic in a function called from the client and multiple events on the server. This commit simplifies the test by separating the server's connection and listening events, and isolating the client logic. Refs: #4476 Refs: #4644 PR-URL: #4650 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Prior to this commit, the test was flaky because it was executing the majority of its logic in a function called from the client and multiple events on the server. This commit simplifies the test by separating the server's connection and listening events, and isolating the client logic. Refs: #4476 Refs: #4644 PR-URL: #4650 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Prior to this commit, the test was flaky because it was executing the majority of its logic in a function called from the client and multiple events on the server. This commit simplifies the test by separating the server's connection and listening events, and isolating the client logic. Refs: nodejs#4476 Refs: nodejs#4644 PR-URL: nodejs#4650 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Prior to this commit, the test was flaky because it was executing the majority of its logic in a function called from the client and multiple events on the server. This commit simplifies the test by separating the server's connection and listening events, and isolating the client logic. Refs: nodejs#4476 Refs: nodejs#4644 PR-URL: nodejs#4650 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Prior to this commit, the test was flaky because it was executing the majority of its logic in a function called from the client and multiple events on the server. This commit simplifies the test by separating the server's connection and listening events, and isolating the client logic. Refs: nodejs#4476 Refs: nodejs#4644 PR-URL: nodejs#4650 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
| Back | FazBrowse Home | New Git URL |
Prior to this commit, the test was flaky because it was executing the majority of its logic in a function called from the client and multiple events on the server. This commit simplifies the test by separating the server's connection and listening events, and isolating the client logic.
Refs: #4476 and #4644
R= @Trott