diff options
author | Rich Trott <rtrott@gmail.com> | 2017-03-12 09:10:50 -0700 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2017-03-16 15:35:17 -0700 |
commit | 5e3d536ea30528c79ecc4a8b36425f82285e03d1 (patch) | |
tree | d76518330f065d3721f6d8f5fd0e4855175d282c /test/parallel/test-domain-abort-on-uncaught.js | |
parent | 746339ef6db2ad5fd417ebf5d573cfc31d19bfdb (diff) | |
download | node-new-5e3d536ea30528c79ecc4a8b36425f82285e03d1.tar.gz |
test: fix flaky test-domain-abort-on-uncaught
test-domain-abort-on-uncaught is flaky under load. Move it to sequential
so it is not competing with other tests for resources.
PR-URL: https://github.com/nodejs/node/pull/11817
Fixes: https://github.com/nodejs/node/issues/11814
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/parallel/test-domain-abort-on-uncaught.js')
-rw-r--r-- | test/parallel/test-domain-abort-on-uncaught.js | 256 |
1 files changed, 0 insertions, 256 deletions
diff --git a/test/parallel/test-domain-abort-on-uncaught.js b/test/parallel/test-domain-abort-on-uncaught.js deleted file mode 100644 index f754541f37..0000000000 --- a/test/parallel/test-domain-abort-on-uncaught.js +++ /dev/null @@ -1,256 +0,0 @@ -'use strict'; - -// This test makes sure that when using --abort-on-uncaught-exception and -// when throwing an error from within a domain that has an error handler -// setup, the process _does not_ abort. - -const common = require('../common'); -const assert = require('assert'); -const domain = require('domain'); -const child_process = require('child_process'); - -let errorHandlerCalled = false; - -const tests = [ - function nextTick() { - const d = domain.create(); - - d.once('error', function(err) { - errorHandlerCalled = true; - }); - - d.run(function() { - process.nextTick(function() { - throw new Error('exceptional!'); - }); - }); - }, - - function timer() { - const d = domain.create(); - - d.on('error', function(err) { - errorHandlerCalled = true; - }); - - d.run(function() { - setTimeout(function() { - throw new Error('exceptional!'); - }, 33); - }); - }, - - function immediate() { - const d = domain.create(); - - d.on('error', function errorHandler() { - errorHandlerCalled = true; - }); - - d.run(function() { - setImmediate(function() { - throw new Error('boom!'); - }); - }); - }, - - function timerPlusNextTick() { - const d = domain.create(); - - d.on('error', function(err) { - errorHandlerCalled = true; - }); - - d.run(function() { - setTimeout(function() { - process.nextTick(function() { - throw new Error('exceptional!'); - }); - }, 33); - }); - }, - - function firstRun() { - const d = domain.create(); - - d.on('error', function(err) { - errorHandlerCalled = true; - }); - - d.run(function() { - throw new Error('exceptional!'); - }); - }, - - function fsAsync() { - const d = domain.create(); - - d.on('error', function errorHandler() { - errorHandlerCalled = true; - }); - - d.run(function() { - const fs = require('fs'); - fs.exists('/non/existing/file', function onExists(exists) { - throw new Error('boom!'); - }); - }); - }, - - function netServer() { - const net = require('net'); - const d = domain.create(); - - d.on('error', function(err) { - errorHandlerCalled = true; - }); - - d.run(function() { - const server = net.createServer(function(conn) { - conn.pipe(conn); - }); - server.listen(0, common.localhostIPv4, function() { - const conn = net.connect(this.address().port, common.localhostIPv4); - conn.once('data', function() { - throw new Error('ok'); - }); - conn.end('ok'); - server.close(); - }); - }); - }, - - function firstRunOnlyTopLevelErrorHandler() { - const d = domain.create(); - const d2 = domain.create(); - - d.on('error', function errorHandler() { - errorHandlerCalled = true; - }); - - d.run(function() { - d2.run(function() { - throw new Error('boom!'); - }); - }); - }, - - function firstRunNestedWithErrorHandler() { - const d = domain.create(); - const d2 = domain.create(); - - d2.on('error', function errorHandler() { - errorHandlerCalled = true; - }); - - d.run(function() { - d2.run(function() { - throw new Error('boom!'); - }); - }); - }, - - function timeoutNestedWithErrorHandler() { - const d = domain.create(); - const d2 = domain.create(); - - d2.on('error', function errorHandler() { - errorHandlerCalled = true; - }); - - d.run(function() { - d2.run(function() { - setTimeout(function() { - console.log('foo'); - throw new Error('boom!'); - }, 33); - }); - }); - }, - - function setImmediateNestedWithErrorHandler() { - const d = domain.create(); - const d2 = domain.create(); - - d2.on('error', function errorHandler() { - errorHandlerCalled = true; - }); - - d.run(function() { - d2.run(function() { - setImmediate(function() { - throw new Error('boom!'); - }); - }); - }); - }, - - function nextTickNestedWithErrorHandler() { - const d = domain.create(); - const d2 = domain.create(); - - d2.on('error', function errorHandler() { - errorHandlerCalled = true; - }); - - d.run(function() { - d2.run(function() { - process.nextTick(function() { - throw new Error('boom!'); - }); - }); - }); - }, - - function fsAsyncNestedWithErrorHandler() { - const d = domain.create(); - const d2 = domain.create(); - - d2.on('error', function errorHandler() { - errorHandlerCalled = true; - }); - - d.run(function() { - d2.run(function() { - const fs = require('fs'); - fs.exists('/non/existing/file', function onExists(exists) { - throw new Error('boom!'); - }); - }); - }); - } -]; - -if (process.argv[2] === 'child') { - const testIndex = +process.argv[3]; - - tests[testIndex](); - - process.on('exit', function onExit() { - assert.strictEqual(errorHandlerCalled, true); - }); -} else { - - tests.forEach(function(test, testIndex) { - let testCmd = ''; - if (!common.isWindows) { - // Do not create core files, as it can take a lot of disk space on - // continuous testing and developers' machines - testCmd += 'ulimit -c 0 && '; - } - - testCmd += process.argv[0]; - testCmd += ' ' + '--abort-on-uncaught-exception'; - testCmd += ' ' + process.argv[1]; - testCmd += ' ' + 'child'; - testCmd += ' ' + testIndex; - - const child = child_process.exec(testCmd); - - child.on('exit', function onExit(code, signal) { - assert.strictEqual(code, 0, 'Test at index ' + testIndex + - ' should have exited with exit code 0 but instead exited with code ' + - code + ' and signal ' + signal); - }); - }); -} |