summaryrefslogtreecommitdiff
path: root/test/parallel/test-cluster-worker-exit.js
diff options
context:
space:
mode:
authorImran Iqbal <imrani@ca.ibm.com>2015-11-04 17:08:07 -0500
committerJames M Snell <jasnell@gmail.com>2015-11-13 21:01:18 -0800
commit8b57b312996794526a8d5efe5935b64ba412c4e6 (patch)
tree5294d707fc876e2602d30cc2c646426636f3a224 /test/parallel/test-cluster-worker-exit.js
parent3fea3cb627fec04a2305c39a206c8332cc5887b3 (diff)
downloadandroid-node-v8-8b57b312996794526a8d5efe5935b64ba412c4e6.tar.gz
android-node-v8-8b57b312996794526a8d5efe5935b64ba412c4e6.tar.bz2
android-node-v8-8b57b312996794526a8d5efe5935b64ba412c4e6.zip
test: Fix test-cluster-worker-exit.js for AIX
test fails intermittently due to the assertion that the 'disconnect' event should come before the 'exit' event. This is caused be the non-deteministic behaviour of pollset_poll[1] on AIX (see deps/uv/src/unix/aix.c). This API makes no garauntee for the order in which file descriptors are returned. On linux epoll_wait[2] is used, which also does not make a garauntee on order of file descriptors returned. In the failing case we recieve our file descriptor with a callback of uv__signal_event (which causes JavaScript to receive the exit event) before our file descriptor with uv__stream_io as its callback (which in turn causes JavaScript receive the disconnect event). This change simply removes the assertion that the disconnect event happens before exit event and processes the test regardless of which event comes first. [1] https://www-01.ibm.com/support/knowledgecenter/ssw_aix_71/com.ibm.ai x.basetrf1/pollset.htm [2] http://linux.die.net/man/2/epoll_pwait PR-URL: https://github.com/nodejs/node/pull/3666 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/parallel/test-cluster-worker-exit.js')
-rw-r--r--test/parallel/test-cluster-worker-exit.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/test/parallel/test-cluster-worker-exit.js b/test/parallel/test-cluster-worker-exit.js
index 3607a992a3..eb941e194b 100644
--- a/test/parallel/test-cluster-worker-exit.js
+++ b/test/parallel/test-cluster-worker-exit.js
@@ -60,8 +60,6 @@ if (cluster.isWorker) {
results.cluster_exitCode = worker.process.exitCode;
results.cluster_signalCode = worker.process.signalCode;
results.cluster_emitExit += 1;
- assert.ok(results.cluster_emitDisconnect,
- "cluster: 'exit' event before 'disconnect' event");
});
// Check worker events and properties
@@ -69,6 +67,9 @@ if (cluster.isWorker) {
results.worker_emitDisconnect += 1;
results.worker_suicideMode = worker.suicide;
results.worker_state = worker.state;
+ if (results.worker_emitExit > 0) {
+ process.nextTick(function() { finish_test(); });
+ }
});
// Check that the worker died
@@ -77,10 +78,9 @@ if (cluster.isWorker) {
results.worker_signalCode = signalCode;
results.worker_emitExit += 1;
results.worker_died = !alive(worker.process.pid);
- assert.ok(results.worker_emitDisconnect,
- "worker: 'exit' event before 'disconnect' event");
-
- process.nextTick(function() { finish_test(); });
+ if (results.worker_emitDisconnect > 0) {
+ process.nextTick(function() { finish_test(); });
+ }
});
var finish_test = function() {