Skip to content

Commit 272732e

Browse files
Trottrvagg
authored andcommitted
test: fix flaky test-child-process-spawnsync-input
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]>
1 parent 781f8c0 commit 272732e

File tree

2 files changed

+27
-12
lines changed

2 files changed

+27
-12
lines changed

test/parallel/test-child-process-spawnsync-input.js

-12
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,3 @@ ret = spawnSync(process.execPath, args, { encoding: 'utf8' });
8787
checkSpawnSyncRet(ret);
8888
assert.strictEqual(ret.stdout, msgOut + '\n');
8989
assert.strictEqual(ret.stderr, msgErr + '\n');
90-
91-
options = {
92-
maxBuffer: 1
93-
};
94-
95-
ret = spawnSync(process.execPath, args, options);
96-
97-
assert.ok(ret.error, 'maxBuffer should error');
98-
assert.strictEqual(ret.error.errno, 'ENOBUFS');
99-
// we can have buffers larger than maxBuffer because underneath we alloc 64k
100-
// that matches our read sizes
101-
assert.deepEqual(ret.stdout, msgOutBuf);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
'use strict';
2+
require('../common');
3+
const assert = require('assert');
4+
5+
const spawnSync = require('child_process').spawnSync;
6+
7+
const msgOut = 'this is stdout';
8+
9+
// This is actually not os.EOL?
10+
const msgOutBuf = new Buffer(msgOut + '\n');
11+
12+
const args = [
13+
'-e',
14+
`console.log("${msgOut}");`
15+
];
16+
17+
const options = {
18+
maxBuffer: 1
19+
};
20+
21+
const ret = spawnSync(process.execPath, args, options);
22+
23+
assert.ok(ret.error, 'maxBuffer should error');
24+
assert.strictEqual(ret.error.errno, 'ENOBUFS');
25+
// We can have buffers larger than maxBuffer because underneath we alloc 64k
26+
// that matches our read sizes
27+
assert.deepEqual(ret.stdout, msgOutBuf);

0 commit comments

Comments
 (0)