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 <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
Trott authored and evanlucas committed Jun 15, 2016
1 parent 40604b5 commit 6ce26c8
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 6ce26c8

Please sign in to comment.