From d8d3296457f3564fa812c171d468d64239a5bbb0 Mon Sep 17 00:00:00 2001 From: atvoicu Date: Thu, 21 Sep 2017 11:13:37 -0700 Subject: [PATCH] Update test-fs-fsync to run from temp. We copy the "a.js" file fixture to a temp directory and then we open it with write access. This makes sure we are only writing to the provided temp-dir and not in the fixture dir. --- test/parallel/test-fs-fsync.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-fs-fsync.js b/test/parallel/test-fs-fsync.js index 006ec3fcc05cf6..3f43dd75450517 100644 --- a/test/parallel/test-fs-fsync.js +++ b/test/parallel/test-fs-fsync.js @@ -25,10 +25,16 @@ const assert = require('assert'); const fixtures = require('../common/fixtures'); const fs = require('fs'); +const path = require('path'); -const file = fixtures.path('a.js'); +const fileFixture = fixtures.path('a.js'); +const fileTemp = path.join(common.tmpDir, 'a.js'); -fs.open(file, 'a', 0o777, common.mustCall(function(err, fd) { +// Copy fixtures to temp. +common.refreshTmpDir(); +fs.copyFileSync(fileFixture, fileTemp); + +fs.open(fileFixture, 'a', 0o777, common.mustCall(function(err, fd) { assert.ifError(err); fs.fdatasyncSync(fd);