Skip to content

Commit

Permalink
test: add test for uid/gid setting in spawn
Browse files Browse the repository at this point in the history
Remove a disabled test in favor of one that expects an error.

This validates (somewhat) that the underlying code is calling the
correct system call for setting UID and GID. Unlike the formerly
disabled test, it does not try to validate that the system UID/GID
setting works.

PR-URL: #7084
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Santiago Gimeno <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
Trott authored and Myles Borins committed Jul 11, 2016
1 parent e0dc5a6 commit 71fd332
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 60 deletions.
60 changes: 0 additions & 60 deletions test/disabled/test-child-process-uid-gid.js

This file was deleted.

14 changes: 14 additions & 0 deletions test/parallel/test-child-process-uid-gid.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
'use strict';
const common = require('../common');
const assert = require('assert');
const spawn = require('child_process').spawn;

const expectedError = common.isWindows ? /\bENOTSUP\b/ : /\bEPERM\b/;

assert.throws(() => {
spawn('echo', ['fhqwhgads'], {uid: 0});
}, expectedError);

assert.throws(() => {
spawn('echo', ['fhqwhgads'], {gid: 0});
}, expectedError);

0 comments on commit 71fd332

Please sign in to comment.