summaryrefslogtreecommitdiff
path: root/test/parallel/test-net-can-reset-timeout.js
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2017-07-15 16:16:31 -0700
committerRich Trott <rtrott@gmail.com>2017-07-15 19:00:25 -0700
commit5d3609dbdd98b3ea3c53a3020305b7567979c888 (patch)
tree143ec2825283ca02596e877c12eab1215d166c0a /test/parallel/test-net-can-reset-timeout.js
parent95ab966a742d23d7271c7b4c36fb84aa2bbece59 (diff)
downloadandroid-node-v8-5d3609dbdd98b3ea3c53a3020305b7567979c888.tar.gz
android-node-v8-5d3609dbdd98b3ea3c53a3020305b7567979c888.tar.bz2
android-node-v8-5d3609dbdd98b3ea3c53a3020305b7567979c888.zip
test: fix flaky test-net-can-reset-timeout
Use `.once()` rather than `.on()` for timeout listener. Add comment with URL for issue explaining the purpose of the test. (h/t refack) PR-URL: https://github.com/nodejs/node/pull/14257 Fixes: https://github.com/nodejs/node/issues/14241 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Diffstat (limited to 'test/parallel/test-net-can-reset-timeout.js')
-rw-r--r--test/parallel/test-net-can-reset-timeout.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/test/parallel/test-net-can-reset-timeout.js b/test/parallel/test-net-can-reset-timeout.js
index a4bdd0bdee..69f6c9288b 100644
--- a/test/parallel/test-net-can-reset-timeout.js
+++ b/test/parallel/test-net-can-reset-timeout.js
@@ -21,6 +21,9 @@
'use strict';
const common = require('../common');
+
+// Ref: https://github.com/nodejs/node-v0.x-archive/issues/481
+
const net = require('net');
const server = net.createServer(common.mustCall(function(stream) {
@@ -28,7 +31,7 @@ const server = net.createServer(common.mustCall(function(stream) {
stream.resume();
- stream.on('timeout', common.mustCall(function() {
+ stream.once('timeout', common.mustCall(function() {
console.log('timeout');
// try to reset the timeout.
stream.write('WHAT.');