Skip to content

Commit

Permalink
test: add check for root user
Browse files Browse the repository at this point in the history
Currently this test fails if run as the root user:
Mismatched innerFn function calls. Expected exactly 62, actual 42.

The motivation for this is that when building node in a docker
container it is convenient to be able to build as root.
  • Loading branch information
danbev committed Apr 10, 2018
1 parent d1156da commit 3791b37
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ const common = require('../common');
const assert = require('assert');
const spawnSync = require('child_process').spawnSync;
const signals = process.binding('constants').os.signals;
const rootUser = process.getuid() === 0;

let invalidArgTypeError;
let invalidArgTypeErrorCount = 62;

if (common.isWindows) {
if (common.isWindows || rootUser) {
invalidArgTypeError =
common.expectsError({ code: 'ERR_INVALID_ARG_TYPE', type: TypeError }, 42);
} else {
Expand Down Expand Up @@ -64,7 +65,7 @@ function fail(option, value, message) {
if (!common.isWindows) {
{
// Validate the uid option
if (process.getuid() !== 0) {
if (!rootUser) {
pass('uid', undefined);
pass('uid', null);
pass('uid', process.getuid());
Expand Down

0 comments on commit 3791b37

Please sign in to comment.