From 25f02bf905f141d1e5dd3ce24c9a10d09df95a74 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Tue, 6 Oct 2015 21:12:45 -0700 Subject: [PATCH] test: refresh temp directory when using pipe common.PIPE resides in the temp directory (except on Windows). Insure that the temp directory is refreshed in tests that use common.PIPE. Fixes: https://github.com/nodejs/node/issues/3227 --- test/parallel/test-async-wrap-check-providers.js | 4 +--- test/parallel/test-cluster-eaccess.js | 1 + test/parallel/test-http-client-pipe-end.js | 2 ++ test/parallel/test-http-client-response-domain.js | 2 ++ test/parallel/test-http-unix-socket.js | 2 ++ test/parallel/test-net-pingpong.js | 2 +- test/parallel/test-net-pipe-connect-errors.js | 1 + test/parallel/test-repl.js | 1 + test/parallel/test-tls-connect-pipe.js | 2 ++ test/sequential/test-pipe-address.js | 2 ++ test/sequential/test-pipe-stream.js | 2 ++ test/sequential/test-pipe-unref.js | 2 ++ 12 files changed, 19 insertions(+), 4 deletions(-) diff --git a/test/parallel/test-async-wrap-check-providers.js b/test/parallel/test-async-wrap-check-providers.js index bec8768e923925..2d7d318885eb16 100644 --- a/test/parallel/test-async-wrap-check-providers.js +++ b/test/parallel/test-async-wrap-check-providers.js @@ -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(); diff --git a/test/parallel/test-cluster-eaccess.js b/test/parallel/test-cluster-eaccess.js index b8c05a2c8a0924..2de4af8b1a108b 100644 --- a/test/parallel/test-cluster-eaccess.js +++ b/test/parallel/test-cluster-eaccess.js @@ -36,6 +36,7 @@ if (cluster.isMaster) { }); } else { + common.refreshTmpDir(); var cp = fork(common.fixturesDir + '/listen-on-socket-and-exit.js', { stdio: 'inherit' }); diff --git a/test/parallel/test-http-client-pipe-end.js b/test/parallel/test-http-client-pipe-end.js index d794aae446c4fa..efe241419397e4 100644 --- a/test/parallel/test-http-client-pipe-end.js +++ b/test/parallel/test-http-client-pipe-end.js @@ -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, diff --git a/test/parallel/test-http-client-response-domain.js b/test/parallel/test-http-client-response-domain.js index 1637882a3c251d..5809d93aee72c4 100644 --- a/test/parallel/test-http-client-response-domain.js +++ b/test/parallel/test-http-client-response-domain.js @@ -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); diff --git a/test/parallel/test-http-unix-socket.js b/test/parallel/test-http-unix-socket.js index 9ec8c8a1572844..98ed839241c2c6 100644 --- a/test/parallel/test-http-unix-socket.js +++ b/test/parallel/test-http-unix-socket.js @@ -18,6 +18,8 @@ var server = http.createServer(function(req, res) { res.end(); }); +common.refreshTmpDir(); + server.listen(common.PIPE, function() { var options = { diff --git a/test/parallel/test-net-pingpong.js b/test/parallel/test-net-pingpong.js index be7dfa435949b5..e27ae2f1819fa6 100644 --- a/test/parallel/test-net-pingpong.js +++ b/test/parallel/test-net-pingpong.js @@ -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'); diff --git a/test/parallel/test-net-pipe-connect-errors.js b/test/parallel/test-net-pipe-connect-errors.js index e2ec1debf12617..81ad90ef829c07 100644 --- a/test/parallel/test-net-pipe-connect-errors.js +++ b/test/parallel/test-net-pipe-connect-errors.js @@ -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() { diff --git a/test/parallel/test-repl.js b/test/parallel/test-repl.js index e121cb7889ab2a..83a9025bec0151 100644 --- a/test/parallel/test-repl.js +++ b/test/parallel/test-repl.js @@ -3,6 +3,7 @@ var common = require('../common'); var assert = require('assert'); common.globalCheck = false; +common.refreshTmpDir(); var net = require('net'), repl = require('repl'), diff --git a/test/parallel/test-tls-connect-pipe.js b/test/parallel/test-tls-connect-pipe.js index 4d607a88830081..ae8062635c85b5 100644 --- a/test/parallel/test-tls-connect-pipe.js +++ b/test/parallel/test-tls-connect-pipe.js @@ -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(); diff --git a/test/sequential/test-pipe-address.js b/test/sequential/test-pipe-address.js index b9e544e97458b4..36488d80f789af 100644 --- a/test/sequential/test-pipe-address.js +++ b/test/sequential/test-pipe-address.js @@ -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(); diff --git a/test/sequential/test-pipe-stream.js b/test/sequential/test-pipe-stream.js index ba4005e9e02fe0..693066c2fb25d0 100644 --- a/test/sequential/test-pipe-stream.js +++ b/test/sequential/test-pipe-stream.js @@ -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; diff --git a/test/sequential/test-pipe-unref.js b/test/sequential/test-pipe-unref.js index 4580f2a66ee4d6..ea6f7c95563928 100644 --- a/test/sequential/test-pipe-unref.js +++ b/test/sequential/test-pipe-unref.js @@ -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();