diff options
author | clang-format-7.0.1 <adam.martin@10gen.com> | 2019-07-26 18:20:35 -0400 |
---|---|---|
committer | ADAM David Alan Martin <adam.martin@10gen.com> | 2019-07-27 11:02:23 -0400 |
commit | 134a4083953270e8a11430395357fb70a29047ad (patch) | |
tree | dd428e1230e31d92b20b393dfdc17ffe7fa79cb6 /jstests/noPassthrough/umask.js | |
parent | 1e46b5049003f427047e723ea5fab15b5a9253ca (diff) | |
download | mongo-134a4083953270e8a11430395357fb70a29047ad.tar.gz |
SERVER-41772 Apply clang-format 7.0.1 to the codebase
Diffstat (limited to 'jstests/noPassthrough/umask.js')
-rw-r--r-- | jstests/noPassthrough/umask.js | 122 |
1 files changed, 62 insertions, 60 deletions
diff --git a/jstests/noPassthrough/umask.js b/jstests/noPassthrough/umask.js index d8869f78f56..8d7234b15d3 100644 --- a/jstests/noPassthrough/umask.js +++ b/jstests/noPassthrough/umask.js @@ -5,74 +5,76 @@ * @tags: [ requires_wiredtiger ] */ (function() { - 'use strict'; - // We only test this on POSIX since that's the only platform where umasks make sense - if (_isWindows()) { - return; - } +'use strict'; +// We only test this on POSIX since that's the only platform where umasks make sense +if (_isWindows()) { + return; +} - const oldUmask = new Number(umask(0)); - jsTestLog("Setting umask to really permissive 000 mode, old mode was " + oldUmask.toString(8)); +const oldUmask = new Number(umask(0)); +jsTestLog("Setting umask to really permissive 000 mode, old mode was " + oldUmask.toString(8)); - const defaultUmask = Number.parseInt("600", 8); - const permissiveUmask = Number.parseInt("666", 8); +const defaultUmask = Number.parseInt("600", 8); +const permissiveUmask = Number.parseInt("666", 8); - // Any files that have some explicit permissions set on them should be added to this list - const exceptions = [ - // The lock file gets created with explicit 644 permissions - 'mongod.lock', - // Mobile se files get created with 644 permissions when honoring the system umask - 'mobile.sqlite', - 'mobile.sqlite-shm', - 'mobile.sqlite-wal', - ]; +// Any files that have some explicit permissions set on them should be added to this list +const exceptions = [ + // The lock file gets created with explicit 644 permissions + 'mongod.lock', + // Mobile se files get created with 644 permissions when honoring the system umask + 'mobile.sqlite', + 'mobile.sqlite-shm', + 'mobile.sqlite-wal', +]; - let mongodOptions = MongoRunner.mongodOptions({ - useLogFiles: true, - cleanData: true, - }); +let mongodOptions = MongoRunner.mongodOptions({ + useLogFiles: true, + cleanData: true, +}); - if (buildInfo()["modules"].some((mod) => { - return mod == "enterprise"; - })) { - mongodOptions.auditDestination = "file"; - mongodOptions.auditPath = mongodOptions.dbpath + "/audit.log"; - mongodOptions.auditFormat = "JSON"; - } +if (buildInfo()["modules"].some((mod) => { + return mod == "enterprise"; + })) { + mongodOptions.auditDestination = "file"; + mongodOptions.auditPath = mongodOptions.dbpath + "/audit.log"; + mongodOptions.auditFormat = "JSON"; +} - const checkMask = (topDir, expected, honoringUmask) => { - const maybeNot = honoringUmask ? "" : " not"; - const processDirectory = (dir) => { - jsTestLog(`Checking ${dir}`); - ls(dir).forEach((file) => { - if (file.endsWith("/")) { - return processDirectory(file); - } else if (exceptions.some((exception) => { - return file.endsWith(exception); - })) { - return; - } - const mode = new Number(getFileMode(file)); - const modeStr = mode.toString(8); - const msg = `Mode for ${file} is ${modeStr} when${maybeNot} honoring system umask`; - assert.eq(mode.valueOf(), expected, msg); - }); - }; - - processDirectory(topDir); +const checkMask = (topDir, expected, honoringUmask) => { + const maybeNot = honoringUmask ? "" : " not"; + const processDirectory = (dir) => { + jsTestLog(`Checking ${dir}`); + ls(dir).forEach((file) => { + if (file.endsWith("/")) { + return processDirectory(file); + } else if (exceptions.some((exception) => { + return file.endsWith(exception); + })) { + return; + } + const mode = new Number(getFileMode(file)); + const modeStr = mode.toString(8); + const msg = `Mode for ${file} is ${modeStr} when${maybeNot} honoring system umask`; + assert.eq(mode.valueOf(), expected, msg); + }); }; - // First we start up the mongod normally, all the files except mongod.lock should have the mode - // 0600 - let conn = MongoRunner.runMongod(mongodOptions); - MongoRunner.stopMongod(conn); - checkMask(conn.fullOptions.dbpath, defaultUmask, false); + processDirectory(topDir); +}; + +// First we start up the mongod normally, all the files except mongod.lock should have the mode +// 0600 +let conn = MongoRunner.runMongod(mongodOptions); +MongoRunner.stopMongod(conn); +checkMask(conn.fullOptions.dbpath, defaultUmask, false); - // Restart the mongod with honorSystemUmask, all files should have the mode 0666 - mongodOptions.setParameter = {honorSystemUmask: true}; - conn = MongoRunner.runMongod(mongodOptions); - MongoRunner.stopMongod(conn); - checkMask(conn.fullOptions.dbpath, permissiveUmask, false); +// Restart the mongod with honorSystemUmask, all files should have the mode 0666 +mongodOptions.setParameter = { + honorSystemUmask: true +}; +conn = MongoRunner.runMongod(mongodOptions); +MongoRunner.stopMongod(conn); +checkMask(conn.fullOptions.dbpath, permissiveUmask, false); - umask(oldUmask.valueOf()); +umask(oldUmask.valueOf()); })(); |