Skip to content

Commit

Permalink
test: fix test-child-process-send-returns-boolean
Browse files Browse the repository at this point in the history
test-child-process-send-returns-boolean was unreliable in CI and
locally.

* use 'SIGKILL' for more reliable process termination
* replace callback with assert.ifError()
* increase interval in fixture from 500ms to 9999ms. It's only purpose
  is to keep the process from exiting.

Fixes: #20135

PR-URL: #20136
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Yuta Hiroto <hello@hiroppy.me>
  • Loading branch information
Trott committed Apr 20, 2018
1 parent 2652ab3 commit 6e6913b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion test/fixtures/child-process-persistent.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
setInterval(function() {}, 500);
setInterval(function() {}, 9999);
4 changes: 2 additions & 2 deletions test/parallel/test-child-process-send-returns-boolean.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ const subScript = fixtures.path('child-process-persistent.js');
// Test `send` return value on `fork` that opens and IPC by default.
const n = fork(subScript);
// `subprocess.send` should always return `true` for the first send.
const rv = n.send({ h: 'w' }, (err) => { if (err) assert.fail(err); });
const rv = n.send({ h: 'w' }, assert.ifError);
assert.strictEqual(rv, true);
n.kill();
n.kill('SIGKILL');
}

{
Expand Down

0 comments on commit 6e6913b

Please sign in to comment.