test: refresh temp directory when using pipe
authorRich Trott <rtrott@gmail.com>
Wed, 7 Oct 2015 04:12:45 +0000 (21:12 -0700)
committerJames M Snell <jasnell@gmail.com>
Sat, 10 Oct 2015 17:38:55 +0000 (10:38 -0700)
common.PIPE resides in the temp directory (except on Windows). Insure
that the temp directory is refreshed in tests that use common.PIPE.

PR-URL: https://github.com/nodejs/node/pull/3231
Fixes: https://github.com/nodejs/node/issues/3227
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
12 files changed:
test/parallel/test-async-wrap-check-providers.js
test/parallel/test-cluster-eaccess.js
test/parallel/test-http-client-pipe-end.js
test/parallel/test-http-client-response-domain.js
test/parallel/test-http-unix-socket.js
test/parallel/test-net-pingpong.js
test/parallel/test-net-pipe-connect-errors.js
test/parallel/test-repl.js
test/parallel/test-tls-connect-pipe.js
test/sequential/test-pipe-address.js
test/sequential/test-pipe-stream.js
test/sequential/test-pipe-unref.js

index bec8768..2d7d318 100644 (file)
@@ -47,9 +47,7 @@ new (process.binding('tty_wrap').TTY)();
 
 crypto.randomBytes(1, noop);
 
-try {
-  fs.unlinkSync(common.PIPE);
-} catch(e) { }
+common.refreshTmpDir();
 
 net.createServer(function(c) {
   c.end();
index b8c05a2..2de4af8 100644 (file)
@@ -36,6 +36,7 @@ if (cluster.isMaster) {
   });
 
 } else {
+  common.refreshTmpDir();
   var cp = fork(common.fixturesDir + '/listen-on-socket-and-exit.js',
                 { stdio: 'inherit' });
 
index d794aae..efe2414 100644 (file)
@@ -14,6 +14,8 @@ var server = http.createServer(function(req, res) {
   });
 });
 
+common.refreshTmpDir();
+
 server.listen(common.PIPE, function() {
   var req = http.request({
     socketPath: common.PIPE,
index 1637882..5809d93 100644 (file)
@@ -11,6 +11,8 @@ process.on('exit', function() {
   assert(gotDomainError);
 });
 
+common.refreshTmpDir();
+
 // first fire up a simple HTTP server
 var server = http.createServer(function(req, res) {
   res.writeHead(200);
index 9ec8c8a..98ed839 100644 (file)
@@ -18,6 +18,8 @@ var server = http.createServer(function(req, res) {
   res.end();
 });
 
+common.refreshTmpDir();
+
 server.listen(common.PIPE, function() {
 
   var options = {
index be7dfa4..e27ae2f 100644 (file)
@@ -106,7 +106,7 @@ function pingPongTest(port, host) {
 }
 
 /* All are run at once, so run on different ports */
-console.log(common.PIPE);
+common.refreshTmpDir();
 pingPongTest(common.PIPE);
 pingPongTest(common.PORT);
 pingPongTest(common.PORT + 1, 'localhost');
index e2ec1de..81ad90e 100644 (file)
@@ -21,6 +21,7 @@ if (common.isWindows) {
 } else {
   // use common.PIPE to ensure we stay within POSIX socket path length
   // restrictions, even on CI
+  common.refreshTmpDir();
   emptyTxt = common.PIPE + '.txt';
 
   function cleanup() {
index e121cb7..83a9025 100644 (file)
@@ -3,6 +3,7 @@ var common = require('../common');
 var assert = require('assert');
 
 common.globalCheck = false;
+common.refreshTmpDir();
 
 var net = require('net'),
     repl = require('repl'),
index 4d607a8..ae80626 100644 (file)
@@ -18,6 +18,8 @@ var options = {
   cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
 };
 
+common.refreshTmpDir();
+
 var server = tls.Server(options, function(socket) {
   ++serverConnected;
   server.close();
index b9e544e..36488d8 100644 (file)
@@ -9,6 +9,8 @@ var server = net.createServer(function() {
   assert(false); // should not be called
 });
 
+common.refreshTmpDir();
+
 server.listen(common.PIPE, function() {
   address = server.address();
   server.close();
index ba4005e..693066c 100644 (file)
@@ -3,6 +3,8 @@ var common = require('../common');
 var assert = require('assert');
 var net = require('net');
 
+common.refreshTmpDir();
+
 function test(clazz, cb) {
   var have_ping = false;
   var have_pong = false;
index 4580f2a..ea6f7c9 100644 (file)
@@ -5,6 +5,8 @@ var assert = require('assert');
 var net = require('net');
 var closed = false;
 
+common.refreshTmpDir();
+
 var s = net.Server();
 s.listen(common.PIPE);
 s.unref();