From cf84f20453564a732c7f1b2086babe70d268ada7 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Wed, 24 Apr 2019 06:28:34 +0200 Subject: [PATCH] test: skip fs-copyfile-respect-permission if root Currently, if this test is run as the root user the following failure will occur: === release test-fs-copyfile-respect-permissions === Path: parallel/test-fs-copyfile-respect-permissions assert.js:89 throw new AssertionError(obj); ^ AssertionError [ERR_ASSERTION]: Missing expected exception (check). at Object. (/node/test/parallel/test-fs-copyfile-respect-permissions.js:38:10) at Module._compile (internal/modules/cjs/loader.js:759:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10) at Module.load (internal/modules/cjs/loader.js:628:32) at Function.Module._load (internal/modules/cjs/loader.js:555:12) at Function.Module.runMain (internal/modules/cjs/loader.js:826:10) at internal/main/run_main_module.js:17:11 Command: out/Release/node test/parallel/test-fs-copyfile-respect-permissions.js [05:41|% 100|+ 2620|- 1]: Done This commit adds a root user check and skips this test if running as the user root. PR-URL: https://github.com/nodejs/node/pull/27378 Reviewed-By: Richard Lau Reviewed-By: Rich Trott Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig Reviewed-By: Yongsheng Zhang --- test/parallel/test-fs-copyfile-respect-permissions.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/parallel/test-fs-copyfile-respect-permissions.js b/test/parallel/test-fs-copyfile-respect-permissions.js index 2021e9ba63155d..ae7829fba38d49 100644 --- a/test/parallel/test-fs-copyfile-respect-permissions.js +++ b/test/parallel/test-fs-copyfile-respect-permissions.js @@ -5,6 +5,9 @@ const common = require('../common'); +if (!common.isWindows && process.getuid() === 0) + common.skip('as this test should not be run as `root`'); + const tmpdir = require('../common/tmpdir'); tmpdir.refresh();