Skip to content

Commit 0503c44

Browse files
atvoicujasnell
authored andcommitted
test: 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. PR-URL: #15537 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
1 parent 29f0ad6 commit 0503c44

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

test/parallel/test-fs-fsync.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,16 @@ const assert = require('assert');
2525
const fixtures = require('../common/fixtures');
2626

2727
const fs = require('fs');
28+
const path = require('path');
2829

29-
const file = fixtures.path('a.js');
30+
const fileFixture = fixtures.path('a.js');
31+
const fileTemp = path.join(common.tmpDir, 'a.js');
3032

31-
fs.open(file, 'a', 0o777, common.mustCall(function(err, fd) {
33+
// Copy fixtures to temp.
34+
common.refreshTmpDir();
35+
fs.copyFileSync(fileFixture, fileTemp);
36+
37+
fs.open(fileFixture, 'a', 0o777, common.mustCall(function(err, fd) {
3238
assert.ifError(err);
3339

3440
fs.fdatasyncSync(fd);

0 commit comments

Comments
 (0)