Skip to content

Commit

Permalink
test: fix flaky test-child-process-spawnsync-input
Browse files Browse the repository at this point in the history
Move portion of `test-child-process-spawnsync-input.js` (that has been
flaky on CentOS in CI) to its own file. This allows us to more easily
eliminate the cause of the flakiness without affecting other unrelated
portions of the test.

Fixes: #3863
PR-URL: #3889
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
Trott authored and rvagg committed Dec 4, 2015
1 parent e99b1ce commit 17176a9
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 12 deletions.
12 changes: 0 additions & 12 deletions test/parallel/test-child-process-spawnsync-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,3 @@ ret = spawnSync(process.execPath, args, { encoding: 'utf8' });
checkSpawnSyncRet(ret);
assert.strictEqual(ret.stdout, msgOut + '\n');
assert.strictEqual(ret.stderr, msgErr + '\n');

options = {
maxBuffer: 1
};

ret = spawnSync(process.execPath, args, options);

assert.ok(ret.error, 'maxBuffer should error');
assert.strictEqual(ret.error.errno, 'ENOBUFS');
// we can have buffers larger than maxBuffer because underneath we alloc 64k
// that matches our read sizes
assert.deepEqual(ret.stdout, msgOutBuf);
27 changes: 27 additions & 0 deletions test/parallel/test-child-process-spawnsync-maxbuf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
'use strict';
require('../common');
const assert = require('assert');

const spawnSync = require('child_process').spawnSync;

const msgOut = 'this is stdout';

// This is actually not os.EOL?
const msgOutBuf = new Buffer(msgOut + '\n');

const args = [
'-e',
`console.log("${msgOut}");`
];

const options = {
maxBuffer: 1
};

const ret = spawnSync(process.execPath, args, options);

assert.ok(ret.error, 'maxBuffer should error');
assert.strictEqual(ret.error.errno, 'ENOBUFS');
// We can have buffers larger than maxBuffer because underneath we alloc 64k
// that matches our read sizes
assert.deepEqual(ret.stdout, msgOutBuf);

0 comments on commit 17176a9

Please sign in to comment.