diff options
author | Mike Grundy <michael.grundy@10gen.com> | 2016-02-04 12:27:19 -0500 |
---|---|---|
committer | Mike Grundy <michael.grundy@10gen.com> | 2016-02-05 15:00:49 -0500 |
commit | c070452eed7d4dc7be2ebff083e0830d3d486896 (patch) | |
tree | f31b3f274c4d2e82b47ad8dc83fa73a77aa65488 /jstests/auth | |
parent | bca7050e6f207a8cec2423bc1a5f3a0645bb1cac (diff) | |
download | mongo-c070452eed7d4dc7be2ebff083e0830d3d486896.tar.gz |
SERVER-22341 fix jslint errors in jstests/auth with eslint --fix
Diffstat (limited to 'jstests/auth')
25 files changed, 102 insertions, 102 deletions
diff --git a/jstests/auth/access_control_with_unreachable_configs.js b/jstests/auth/access_control_with_unreachable_configs.js index 6c91e7a2a84..23a38502301 100644 --- a/jstests/auth/access_control_with_unreachable_configs.js +++ b/jstests/auth/access_control_with_unreachable_configs.js @@ -3,7 +3,7 @@ // are user documents stored in the configuration information, it must assume that // there are. -var dopts = { smallfiles: "", nopreallocj: ""} +var dopts = { smallfiles: "", nopreallocj: ""}; var st = new ShardingTest( { shards: 1, mongos: 1, @@ -32,7 +32,7 @@ assert.commandFailedWithCode(db.adminCommand('serverStatus'), authzErrorCode); db.auth('user', 'pwd'); assert.commandWorked(db.adminCommand('serverStatus')); -jsTest.log('repeat without config server') +jsTest.log('repeat without config server'); // shut down only config server MongoRunner.stopMongod(config.port, /*signal*/15); diff --git a/jstests/auth/auth1.js b/jstests/auth/auth1.js index a15d4a46995..560d54828fc 100644 --- a/jstests/auth/auth1.js +++ b/jstests/auth/auth1.js @@ -34,7 +34,7 @@ function runTest(m) { db.createUser({user: "guest" , pwd: "guest", roles: jsTest.readOnlyUserRoles}); db.getSisterDB("admin").logout(); - assert.throws( function() { t.findOne() }, [], "read without login" ); + assert.throws( function() { t.findOne(); }, [], "read without login" ); print("make sure we can't run certain commands w/out auth"); var codeUnauthorized = 13; @@ -59,7 +59,7 @@ function runTest(m) { db.setProfilingLevel( 2 ); t.count(); db.setProfilingLevel( 0 ); - assert.lt( 0 , db.system.profile.find( { user : "eliot@test" } ).count() , "AP1" ) + assert.lt( 0 , db.system.profile.find( { user : "eliot@test" } ).count() , "AP1" ); var p = { key : { i : true } , reduce : function(obj,prev) { prev.count++; }, @@ -86,14 +86,14 @@ function runTest(m) { }; - assert.throws( function() { return t.group( p ) }, null , "write reduce didn't fail" ); + assert.throws( function() { return t.group( p ); }, null , "write reduce didn't fail" ); assert.eq( 1000, dbRO.jstests_auth_auth1.count() , "C3" ); db.getSiblingDB('admin').auth('super', 'super'); assert.eq( 1000, db.eval( function() { return db[ "jstests_auth_auth1" ].count(); } ) , "D1" ); - db.eval( function() { db[ "jstests_auth_auth1" ].save( {i:1000} ) } ); + db.eval( function() { db[ "jstests_auth_auth1" ].save( {i:1000} ); } ); assert.eq( 1001, db.eval( function() { return db[ "jstests_auth_auth1" ].count(); } ) , "D2" ); print("SUCCESS auth1.js"); diff --git a/jstests/auth/auth3.js b/jstests/auth/auth3.js index fde160d06ce..9ec028aca21 100644 --- a/jstests/auth/auth3.js +++ b/jstests/auth/auth3.js @@ -1,6 +1,6 @@ (function() { -'use strict' +'use strict'; var conn = MongoRunner.runMongod({ auth: "" }); diff --git a/jstests/auth/auth_helpers.js b/jstests/auth/auth_helpers.js index fc26372ba0d..f35f2f579af 100644 --- a/jstests/auth/auth_helpers.js +++ b/jstests/auth/auth_helpers.js @@ -10,7 +10,7 @@ var mechanisms, hasCR, hasCramMd5; var admin = conn.getDB('admin'); // In order to test MONGODB-CR we need to "reset" the authSchemaVersion to // 26Final "3" or else the user won't get MONGODB-CR credentials. -admin.system.version.save({ "_id" : "authSchema", "currentVersion" : 3 }) +admin.system.version.save({ "_id" : "authSchema", "currentVersion" : 3 }); admin.createUser({user:'andy', pwd: 'a', roles: jsTest.adminUserRoles}); admin.auth({user: 'andy', pwd: 'a'}); diff --git a/jstests/auth/auth_schema_upgrade.js b/jstests/auth/auth_schema_upgrade.js index 001e5c04a1b..95dcaad70eb 100644 --- a/jstests/auth/auth_schema_upgrade.js +++ b/jstests/auth/auth_schema_upgrade.js @@ -5,7 +5,7 @@ var setupCRUsers = function(conn){ jsTest.log("setting up legacy users"); var adminDB = conn.getDB('admin'); - adminDB.system.version.update({_id:"authSchema"},{"currentVersion":3},{upsert:true}) + adminDB.system.version.update({_id:"authSchema"},{"currentVersion":3},{upsert:true}); adminDB.createUser({user: 'user1', pwd: 'pass', roles: jsTest.adminUserRoles}); @@ -34,7 +34,7 @@ var setupCRUsers = function(conn){ verifyAuth(adminDB, 'user1', 'newpass', true, true); verifyUserDoc(adminDB, 'user1', true, false); -} +}; var verifySchemaUpgrade = function(adminDB) { // All users should only have SCRAM credentials. @@ -45,7 +45,7 @@ var verifySchemaUpgrade = function(adminDB) { // After authSchemaUpgrade MONGODB-CR no longer works. verifyAuth(adminDB, 'user1', 'newpass', false, true); verifyAuth(adminDB, 'user2', 'pass', false, true); -} +}; var runAndVerifySchemaUpgrade = function(conn){ jsTest.log("run authSchemaUpgrade"); @@ -53,12 +53,12 @@ var runAndVerifySchemaUpgrade = function(conn){ assert.commandWorked(adminDB.runCommand('authSchemaUpgrade')); verifySchemaUpgrade(adminDB); -} +}; var testAuthSchemaUpgrade = function(conn) { setupCRUsers(conn); runAndVerifySchemaUpgrade(conn); -} +}; // Test authSchemaUpgrade and upgrade shards var testUpgradeShards = function(mongos, shard) { @@ -66,7 +66,7 @@ var testUpgradeShards = function(mongos, shard) { assert.commandWorked(mongos.adminCommand({"authSchemaUpgrade":1,"upgradeShards":1})); verifySchemaUpgrade(shard.getDB('admin')); -} +}; jsTest.log('Test authSchemUpgrade standalone'); var conn = MongoRunner.runMongod(); @@ -74,7 +74,7 @@ testAuthSchemaUpgrade(conn); MongoRunner.stopMongod(conn); jsTest.log('Test authSchemUpgrade sharded'); -var dopts = { smallfiles: "", nopreallocj: ""} +var dopts = { smallfiles: "", nopreallocj: ""}; var st = new ShardingTest( { shards: 1, mongos: 1, diff --git a/jstests/auth/builtin_roles_system_colls.js b/jstests/auth/builtin_roles_system_colls.js index 15b99c8af28..0ce2d98664d 100644 --- a/jstests/auth/builtin_roles_system_colls.js +++ b/jstests/auth/builtin_roles_system_colls.js @@ -18,7 +18,7 @@ function testUserAdminAnyDatabaseSystemCollIndexing(adminDB) { assert.commandWorked(adminDB.system.users.dropIndex({ db: 1 })); assert.commandWorked(adminDB.system.roles.dropIndex({ db: 1 })); adminDB.logout(); -}; +} // SERVER-14701: the backup role should be able to run the diff --git a/jstests/auth/commands_builtin_roles.js b/jstests/auth/commands_builtin_roles.js index cb5bb984479..a089278da6c 100644 --- a/jstests/auth/commands_builtin_roles.js +++ b/jstests/auth/commands_builtin_roles.js @@ -148,11 +148,11 @@ function checkForNonExistentRoles() { var opts = { auth:"", enableExperimentalStorageDetailsCmd: "" -} +}; var impls = { createUsers: createUsers, runOneTest: runOneTest -} +}; checkForNonExistentRoles(); diff --git a/jstests/auth/commands_user_defined_roles.js b/jstests/auth/commands_user_defined_roles.js index 3bcb8726072..1d567df7462 100644 --- a/jstests/auth/commands_user_defined_roles.js +++ b/jstests/auth/commands_user_defined_roles.js @@ -179,11 +179,11 @@ function createUsers(conn) { var opts = { auth:"", enableExperimentalStorageDetailsCmd: "" -} +}; var impls = { createUsers: createUsers, runOneTest: runOneTest -} +}; // run all tests standalone var conn = MongoRunner.runMongod(opts); diff --git a/jstests/auth/copyauth.js b/jstests/auth/copyauth.js index a0e0b92c51e..4fb74101ad5 100644 --- a/jstests/auth/copyauth.js +++ b/jstests/auth/copyauth.js @@ -34,7 +34,7 @@ function ClusterSpawnHelper(clusterType, startWithAuth) { mongos : 1, shards : 1, config : 1 - } + }; if (startWithAuth) { shardingTestConfig.auth = ""; shardingTestConfig.keyFile = "jstests/libs/key1"; @@ -82,7 +82,7 @@ function ClusterSpawnHelper(clusterType, startWithAuth) { else { MongoRunner.stopMongod(this.conn.port); } - } + }; } /* @@ -110,7 +110,7 @@ function copydbBetweenClustersTest(configObj) { 'isSourceUsingAuth', 'targetClusterType', 'isTargetUsingAuth' - ] + ]; var i; for (i = 0; i < requiredKeys.length; i++) { @@ -186,12 +186,12 @@ function copydbBetweenClustersTest(configObj) { } (function() { -"use strict" +"use strict"; -var sourceClusterTypeValues = [ "single", "repl", "sharded" ] -var isSourceUsingAuthValues = [ true, false ] -var targetClusterTypeValues = [ "single", "repl", "sharded" ] -var isTargetUsingAuthValues = [ true, false ] +var sourceClusterTypeValues = [ "single", "repl", "sharded" ]; +var isSourceUsingAuthValues = [ true, false ]; +var targetClusterTypeValues = [ "single", "repl", "sharded" ]; +var isTargetUsingAuthValues = [ true, false ]; for (var i = 0; i < sourceClusterTypeValues.length; i++) { for (var j = 0; j < isSourceUsingAuthValues.length; j++) { for (var k = 0; k < targetClusterTypeValues.length; k++) { @@ -223,7 +223,7 @@ for (var i = 0; i < sourceClusterTypeValues.length; i++) { 'isSourceUsingAuth' : isSourceUsingAuthValues[j], 'targetClusterType' : targetClusterTypeValues[k], 'isTargetUsingAuth' : isTargetUsingAuthValues[l] - } + }; print("Running copydb with auth test:"); printjson(testCase); copydbBetweenClustersTest(testCase); diff --git a/jstests/auth/db_multiple_login.js b/jstests/auth/db_multiple_login.js index 13bef7bcc59..ed48bfb4e98 100644 --- a/jstests/auth/db_multiple_login.js +++ b/jstests/auth/db_multiple_login.js @@ -15,7 +15,7 @@ admin.logout(); // Nothing logged in, can neither read nor write. assert.writeError(test.docs.insert({ value: 0 })); -assert.throws(function() { test.foo.findOne() }); +assert.throws(function() { test.foo.findOne(); }); // Writer logged in, can read and write. test.auth('writer', 'a'); diff --git a/jstests/auth/iteration_count_control.js b/jstests/auth/iteration_count_control.js index 7525d01ea75..b0a790c43c6 100644 --- a/jstests/auth/iteration_count_control.js +++ b/jstests/auth/iteration_count_control.js @@ -29,7 +29,7 @@ var testIterationCountControl = function(){ scramIterationCount: 4999})); assert.commandFailed(adminDB.runCommand({setParameter: 1, scramIterationCount: -5000})); -} +}; testIterationCountControl(); MongoRunner.stopMongod(conn); diff --git a/jstests/auth/js_scope_leak.js b/jstests/auth/js_scope_leak.js index 0d4285306ea..57e0b112937 100644 --- a/jstests/auth/js_scope_leak.js +++ b/jstests/auth/js_scope_leak.js @@ -23,7 +23,7 @@ function missingOrEquals(string) { // + 'print(global.hasOwnProperty("someGlobal") ? someGlobal : "MISSING" );' + 'return !global.hasOwnProperty("someGlobal")' + ' || someGlobal == unescape("' + escape(string) + '");' - +'}()' + +'}()'; } function testDbEval() { @@ -71,15 +71,15 @@ testWhere(); testWhere(); function testMapReduce() { - var mapSet = function(string) { return Function('someGlobal = "' + string + '"'); } - var mapGet = function(string) { return Function('assert(' + missingOrEquals(string) +')'); } - var reduce = function(k, v) { } + var mapSet = function(string) { return Function('someGlobal = "' + string + '"'); }; + var mapGet = function(string) { return Function('assert(' + missingOrEquals(string) +')'); }; + var reduce = function(k, v) { }; var setGlobalInMap = function(string) { test.foo.mapReduce(mapSet(string), reduce, {out:{inline:1}}); - } + }; var getGlobalFromMap = function(string) { test.foo.mapReduce(mapGet(string), reduce, {out:{inline:1}}); - } + }; // set the global variable 'someGlobal' before authenticating setGlobalInMap('noUsers'); @@ -107,13 +107,13 @@ function testGroup() { reduce: Function('doc1', 'agg', 'someGlobal = "' + string + '"'), initial:{}}); - } + }; var getGlobalFromGroup = function(string) { return test.foo.group({key: 'a', reduce: Function('doc1', 'agg', 'assert(' + missingOrEquals(string) +')'), initial:{}}); - } + }; // set the global variable 'someGlobal' before authenticating setGlobalInGroup('noUsers'); diff --git a/jstests/auth/lib/commands_lib.js b/jstests/auth/lib/commands_lib.js index 9aaa7d6a58d..69339a7655a 100644 --- a/jstests/auth/lib/commands_lib.js +++ b/jstests/auth/lib/commands_lib.js @@ -2844,8 +2844,8 @@ var authCommandsLib = { failures = failures.concat(res); } - failures.forEach(function(i) { jsTest.log(i) }); + failures.forEach(function(i) { jsTest.log(i); }); assert.eq(0, failures.length); } -} +}; diff --git a/jstests/auth/logout_reconnect.js b/jstests/auth/logout_reconnect.js index 119284ce9d4..dc59d408544 100644 --- a/jstests/auth/logout_reconnect.js +++ b/jstests/auth/logout_reconnect.js @@ -14,7 +14,7 @@ var testDB = conn.getDB('test'); var adminDB = conn.getDB('admin'); adminDB.createUser({user:'admin', pwd:'admin', roles:['userAdminAnyDatabase']}); adminDB.auth('admin','admin'); -testDB.createUser({user:'rwuser', pwd:'rwuser', roles:['readWrite']}) +testDB.createUser({user:'rwuser', pwd:'rwuser', roles:['readWrite']}); adminDB.logout(); testDB.auth('rwuser', 'rwuser'); @@ -24,7 +24,7 @@ assert.eq(1, testDB.foo.find({a:1}).count(), "failed to read"); // assert that the user cannot read unauthenticated testDB.logout(); -assert.throws(function(){ testDB.foo.findOne() }, +assert.throws(function(){ testDB.foo.findOne(); }, [], "user should not be able to read after logging out"); @@ -41,7 +41,7 @@ try{ catch(err){} // assert that credentials were not autosubmitted on reconnect -assert.throws(function(){ testDB.foo.findOne() }, +assert.throws(function(){ testDB.foo.findOne(); }, [], "user should not be able to read after logging out"); diff --git a/jstests/auth/mr_auth.js b/jstests/auth/mr_auth.js index 6ef85be9b7b..421c5d21bf7 100644 --- a/jstests/auth/mr_auth.js +++ b/jstests/auth/mr_auth.js @@ -7,9 +7,9 @@ baseName = "jstests_mr_auth"; dbName = "test"; out = baseName + "_out"; -map = function(){ emit( this.x, this.y );} -red = function( k, vs ){ var s=0; for (var i=0; i<vs.length; i++) s+=vs[i]; return s;} -red2 = function( k, vs ){ return 42;} +map = function(){ emit( this.x, this.y );}; +red = function( k, vs ){ var s=0; for (var i=0; i<vs.length; i++) s+=vs[i]; return s;}; +red2 = function( k, vs ){ return 42;}; // make sure writing is allowed when started without --auth enabled @@ -27,11 +27,11 @@ d.createUser({user: "write" , pwd: "write", roles: jsTest.basicUserRoles}); d.createUser({user: "read" , pwd: "read", roles: jsTest.readOnlyUserRoles}); d.getSisterDB( "admin" ).logout(); -t.mapReduce( map, red, {out: { inline: 1 }} ) +t.mapReduce( map, red, {out: { inline: 1 }} ); -t.mapReduce( map, red, {out: { replace: out }} ) -t.mapReduce( map, red, {out: { reduce: out }} ) -t.mapReduce( map, red, {out: { merge: out }} ) +t.mapReduce( map, red, {out: { replace: out }} ); +t.mapReduce( map, red, {out: { reduce: out }} ); +t.mapReduce( map, red, {out: { merge: out }} ); d[ out ].drop(); @@ -44,38 +44,38 @@ dbms = MongoRunner.runMongod({restart: true, cleanData: false, dbpath: dbms.dbpa d = dbms.getDB( dbName ); t = d[ baseName ]; -assert.throws( function() { t.findOne() }, [], "read without login" ); +assert.throws( function() { t.findOne(); }, [], "read without login" ); -assert.throws( function(){ t.mapReduce( map, red, {out: { inline: 1 }} ) }, [], "m/r without login" ); +assert.throws( function(){ t.mapReduce( map, red, {out: { inline: 1 }} ); }, [], "m/r without login" ); d.auth( "read", "read" ); -t.findOne() +t.findOne(); -t.mapReduce( map, red, {out: { inline: 1 }} ) +t.mapReduce( map, red, {out: { inline: 1 }} ); -assert.throws( function(){ t.mapReduce( map, red2, {out: { replace: out }} ) }, [], "read-only user shouldn't be able to output m/r to a collection" ); -assert.throws( function(){ t.mapReduce( map, red2, {out: { reduce: out }} ) }, [], "read-only user shouldn't be able to output m/r to a collection" ); -assert.throws( function(){ t.mapReduce( map, red2, {out: { merge: out }} ) }, [], "read-only user shouldn't be able to output m/r to a collection" ); +assert.throws( function(){ t.mapReduce( map, red2, {out: { replace: out }} ); }, [], "read-only user shouldn't be able to output m/r to a collection" ); +assert.throws( function(){ t.mapReduce( map, red2, {out: { reduce: out }} ); }, [], "read-only user shouldn't be able to output m/r to a collection" ); +assert.throws( function(){ t.mapReduce( map, red2, {out: { merge: out }} ); }, [], "read-only user shouldn't be able to output m/r to a collection" ); assert.eq (0, d[ out ].count(), "output collection should be empty"); d.logout(); -assert.throws( function(){ t.mapReduce( map, red, {out: { replace: out }} ) }, [], "m/r without login" ); +assert.throws( function(){ t.mapReduce( map, red, {out: { replace: out }} ); }, [], "m/r without login" ); -d.auth( "write", "write" ) +d.auth( "write", "write" ); -t.mapReduce( map, red, {out: { inline: 1 }} ) +t.mapReduce( map, red, {out: { inline: 1 }} ); -t.mapReduce( map, red, {out: { replace: out }} ) -t.mapReduce( map, red, {out: { reduce: out }} ) -t.mapReduce( map, red, {out: { merge: out }} ) +t.mapReduce( map, red, {out: { replace: out }} ); +t.mapReduce( map, red, {out: { reduce: out }} ); +t.mapReduce( map, red, {out: { merge: out }} ); // make sure it fails if output to a diff db -assert.throws(function() { t.mapReduce( map, red, {out: { replace: out, db: "admin" }} ) }) +assert.throws(function() { t.mapReduce( map, red, {out: { replace: out, db: "admin" }} ); }); MongoRunner.stopMongod(dbms); diff --git a/jstests/auth/pseudo_commands.js b/jstests/auth/pseudo_commands.js index be02c2534f0..629b1fde0d3 100644 --- a/jstests/auth/pseudo_commands.js +++ b/jstests/auth/pseudo_commands.js @@ -47,7 +47,7 @@ function runTest(conn) { function isMongos(db) { var res = db.adminCommand({isdbgrid: 1}); return (res.ok == 1 && res.isdbgrid == 1); - }; + } (function testInprog() { @@ -83,7 +83,7 @@ function runTest(conn) { if (shouldPass) { assert.gte(res.inprog.length, 0); } - } + }; testProperAuthorization(testFunc, roles, privilege); })(); @@ -124,7 +124,7 @@ function runTest(conn) { passed = false; } assert.eq(shouldPass, passed); - } + }; testProperAuthorization(testFunc, roles, privilege); })(); @@ -175,7 +175,7 @@ function runTest(conn) { } assert.eq(shouldPass, passed); - } + }; testProperAuthorization(testFunc, roles, privilege); })(); diff --git a/jstests/auth/rename.js b/jstests/auth/rename.js index 1e6b0092a65..a83d2e75caa 100644 --- a/jstests/auth/rename.js +++ b/jstests/auth/rename.js @@ -8,7 +8,7 @@ var admin = m.getDB( 'admin' ); // Setup initial data admin.createUser({user:'admin', pwd: 'password', roles: jsTest.adminUserRoles}); -admin.auth('admin', 'password') +admin.auth('admin', 'password'); db1.createUser({user: "foo", pwd: "bar", roles: jsTest.basicUserRoles}); db2.createUser({user: "bar", pwd: "foo", roles: jsTest.basicUserRoles}); @@ -23,7 +23,7 @@ admin.logout(); assert.commandFailed( admin.runCommand({renameCollection:db1.a.getFullName(), to: db1.b.getFullName()}) ); // can run same db with auth -db1.auth('foo', 'bar') +db1.auth('foo', 'bar'); assert.commandWorked( admin.runCommand({renameCollection:db1.a.getFullName(), to: db1.b.getFullName()}) ); // can't run diff db w/o auth diff --git a/jstests/auth/renameSystemCollections.js b/jstests/auth/renameSystemCollections.js index 81de51de575..7e4c7b821e3 100644 --- a/jstests/auth/renameSystemCollections.js +++ b/jstests/auth/renameSystemCollections.js @@ -7,7 +7,7 @@ var testDB2 = conn.getDB("testdb2"); var CodeUnauthorized = 13; -var backdoorUserDoc = { user: 'backdoor', db: 'admin', pwd: 'hashed', roles: ['root'] } +var backdoorUserDoc = { user: 'backdoor', db: 'admin', pwd: 'hashed', roles: ['root'] }; adminDB.createUser({user:'userAdmin', pwd:'password', diff --git a/jstests/auth/repl.js b/jstests/auth/repl.js index 8e384f91296..1ed13ad1400 100644 --- a/jstests/auth/repl.js +++ b/jstests/auth/repl.js @@ -125,7 +125,7 @@ var AuthReplTest = function(spec) { secondaryConn = secondary; secondaryConn.setSlaveOk(true); adminSec = secondaryConn.getDB("admin"); - } + }; /** * Create user and roles in preparation @@ -177,7 +177,7 @@ var AuthReplTest = function(spec) { }; return that; -} +}; jsTest.log("1 test replica sets"); var rs = new ReplSetTest({name: rsName, nodes: 2}); diff --git a/jstests/auth/resource_pattern_matching.js b/jstests/auth/resource_pattern_matching.js index 74583f6c270..7acad4f5f1f 100644 --- a/jstests/auth/resource_pattern_matching.js +++ b/jstests/auth/resource_pattern_matching.js @@ -210,26 +210,26 @@ function run_tests(granter, verifier) { ], { "a.a" : function(testdb, testcol) { should_insert(testdb, testcol); - should_find(testdb, testcol) }, + should_find(testdb, testcol); }, "a.b" : function(testdb, testcol) { should_insert(testdb, testcol); - should_fail_find(testdb, testcol) }, + should_fail_find(testdb, testcol); }, "b.a" : function(testdb, testcol) { should_insert(testdb, testcol); - should_fail_find(testdb, testcol) }, + should_fail_find(testdb, testcol); }, "b.b" : function(testdb, testcol) { should_insert(testdb, testcol); - should_fail_find(testdb, testcol) }, + should_fail_find(testdb, testcol); }, } ); } -var keyfile = "jstests/libs/key1" +var keyfile = "jstests/libs/key1"; -print('--- standalone node test ---') +print('--- standalone node test ---'); var conn = MongoRunner.runMongod({auth: null, keyFile: keyfile}); run_tests(conn.getDB('test'), conn.getDB('test')); MongoRunner.stopMongod(conn); -print('--- done standalone node test ---') +print('--- done standalone node test ---'); -print('--- replica set test ---') +print('--- replica set test ---'); var rst = new ReplSetTest({ name: 'testset', nodes: 2, @@ -245,7 +245,7 @@ run_tests(primary, secondary); rst.stopSet(); print('--- done with the rs tests ---'); -print('--- sharding test ---') +print('--- sharding test ---'); var st = new ShardingTest({ mongos: 2, shard: 1, @@ -255,7 +255,7 @@ var st = new ShardingTest({ configOptions: { 'auth': null, 'httpinterface': null }, shardOptions: { 'auth': null, 'httpinterface': null } } -}) +}); run_tests(st.s0.getDB('admin'), st.s1.getDB('admin')); st.stop(); print('--- sharding test done ---'); diff --git a/jstests/auth/role_management_commands.js b/jstests/auth/role_management_commands.js index dbc5d825bde..54b7b91b8c8 100644 --- a/jstests/auth/role_management_commands.js +++ b/jstests/auth/role_management_commands.js @@ -237,7 +237,7 @@ function runTest(conn) { (function testDropRole() { jsTestLog("Testing dropRole"); - testUserAdmin.grantRolesToUser('testUser', ['testRole4']) + testUserAdmin.grantRolesToUser('testUser', ['testRole4']); assert.doesNotThrow(function() {db.foo.findOne();}); assert.writeOK(db.foo.insert({ a: 1 })); diff --git a/jstests/auth/system_user_privileges.js b/jstests/auth/system_user_privileges.js index 7a3ab75f352..1a1c1151be8 100644 --- a/jstests/auth/system_user_privileges.js +++ b/jstests/auth/system_user_privileges.js @@ -67,7 +67,7 @@ // Validate that you cannot even log in as __system@local with the supplied password; you _must_ // use the password from the keyfile. // - assert(!local.auth('__system', 'a')) + assert(!local.auth('__system', 'a')); assertCountUnauthorized(conn, "admin", "foo"); assertCountUnauthorized(conn, "local", "foo"); assertCountUnauthorized(conn, "test", "foo"); diff --git a/jstests/auth/user_defined_roles.js b/jstests/auth/user_defined_roles.js index 50ab0c8acfc..25eb885366c 100644 --- a/jstests/auth/user_defined_roles.js +++ b/jstests/auth/user_defined_roles.js @@ -42,13 +42,13 @@ function runTest(conn) { // test CRUD hasAuthzError(testDB.foo.insert({ a: 1 })); - assert.throws(function() { testDB.foo.findOne()}); + assert.throws(function() { testDB.foo.findOne();}); testUserAdmin.grantPrivilegesToRole('testRole1', [{resource: {db: 'test', collection: ''}, actions:['find']}]); hasAuthzError(testDB.foo.insert({ a: 1 })); - assert.doesNotThrow(function() { testDB.foo.findOne()}); + assert.doesNotThrow(function() { testDB.foo.findOne();}); assert.eq(0, testDB.foo.count()); assert.eq(0, testDB.foo.find().itcount()); @@ -56,11 +56,11 @@ function runTest(conn) { actions:['insert']}]); assert.writeOK(testDB.foo.insert({ a: 1 })); - assert.eq(1, testDB.foo.findOne().a) + assert.eq(1, testDB.foo.findOne().a); assert.eq(1, testDB.foo.count()); assert.eq(1, testDB.foo.find().itcount()); hasAuthzError(testDB.foo.update({ a: 1 }, { $inc: { a: 1 }})); - assert.eq(1, testDB.foo.findOne().a) + assert.eq(1, testDB.foo.findOne().a); hasAuthzError(testDB.bar.insert({ a: 1 })); assert.eq(0, testDB.bar.count()); @@ -68,7 +68,7 @@ function runTest(conn) { adminUserAdmin.grantPrivilegesToRole('adminRole', [{resource: {db: '', collection: 'foo'}, actions:['update']}]); assert.writeOK(testDB.foo.update({ a: 1 }, { $inc: { a: 1 }})); - assert.eq(2, testDB.foo.findOne().a) + assert.eq(2, testDB.foo.findOne().a); assert.writeOK(testDB.foo.update({ b: 1 }, { $inc: { b: 1 }}, true)); // upsert assert.eq(2, testDB.foo.count()); assert.eq(2, testDB.foo.findOne({b: {$exists: true}}).b); @@ -94,7 +94,7 @@ function runTest(conn) { // Test changeOwnPassword/changeOwnCustomData assert.throws(function() { testDB.changeUserPassword('testUser', 'password'); }); - assert.throws(function() { testDB.updateUser('testUser', {customData: {zipCode: 10036}})}); + assert.throws(function() { testDB.updateUser('testUser', {customData: {zipCode: 10036}});}); assert.eq(null, testDB.getUser('testUser').customData); testUserAdmin.grantPrivilegesToRole('testRole1', [{resource: {db: 'test', collection: ''}, actions:['changeOwnPassword', @@ -107,8 +107,8 @@ function runTest(conn) { testUserAdmin.revokeRolesFromRole('testRole2', ['testRole1']); assert.throws(function() { testDB.changeUserPassword('testUser', 'pwd'); }); - assert.throws(function() { testDB.foo.findOne()}); - assert.throws(function() { testDB.updateUser('testUser', {customData: {zipCode: 10028}})}); + assert.throws(function() { testDB.foo.findOne();}); + assert.throws(function() { testDB.updateUser('testUser', {customData: {zipCode: 10028}});}); assert.eq(10036, testDB.getUser('testUser').customData.zipCode); // Test changeAnyPassword/changeAnyCustomData diff --git a/jstests/auth/user_management_commands.js b/jstests/auth/user_management_commands.js index 1a428d9d409..1a777a00e6b 100644 --- a/jstests/auth/user_management_commands.js +++ b/jstests/auth/user_management_commands.js @@ -55,14 +55,14 @@ function runTest(conn) { assert(db.auth('spencer', 'pwd')); assert.writeOK(db.foo.insert({ a: 1 })); assert.eq(1, db.foo.findOne().a); - assert.doesNotThrow(function() {db.getRole('testRole')}); + assert.doesNotThrow(function() {db.getRole('testRole');}); assert.commandWorked(db.adminCommand('connPoolSync')); db.logout(); assert(db.auth('andy', 'pwd')); hasAuthzError(db.foo.insert({ a: 1 })); assert.throws(function() { db.foo.findOne();}); - assert.throws(function() {db.getRole('testRole')}); + assert.throws(function() {db.getRole('testRole');}); })(); (function testUpdateUser() { @@ -81,7 +81,7 @@ function runTest(conn) { hasAuthzError(db.foo.insert({ a: 1 })); assert.eq(1, db.foo.findOne().a); assert.eq(1, db.foo.count()); - assert.doesNotThrow(function() {db.getRole('testRole')}); + assert.doesNotThrow(function() {db.getRole('testRole');}); assert.commandFailedWithCode(db.adminCommand('connPoolSync'), authzErrorCode); testUserAdmin.updateUser('spencer', {roles: ["readWrite", @@ -89,7 +89,7 @@ function runTest(conn) { assert.writeOK(db.foo.update({}, { $inc: { a: 1 }})); assert.eq(2, db.foo.findOne().a); assert.eq(1, db.foo.count()); - assert.throws(function() {db.getRole('testRole')}); + assert.throws(function() {db.getRole('testRole');}); assert.commandWorked(db.adminCommand('connPoolSync')); })(); @@ -110,7 +110,7 @@ function runTest(conn) { assert.writeOK(db.foo.update({}, { $inc: { a: 1 }})); assert.eq(3, db.foo.findOne().a); assert.eq(1, db.foo.count()); - assert.doesNotThrow(function() {db.getRole('testRole')}); + assert.doesNotThrow(function() {db.getRole('testRole');}); assert.commandWorked(db.adminCommand('connPoolSync')); })(); @@ -125,7 +125,7 @@ function runTest(conn) { assert.commandWorked(db.runCommand({collMod: 'foo', usePowerOf2Sizes: true})); hasAuthzError(db.foo.update({}, { $inc: { a: 1 }})); assert.throws(function() { db.foo.findOne();}); - assert.throws(function() {db.getRole('testRole')}); + assert.throws(function() {db.getRole('testRole');}); assert.commandWorked(db.adminCommand('connPoolSync')); @@ -133,7 +133,7 @@ function runTest(conn) { hasAuthzError(db.foo.update({}, { $inc: { a: 1 }})); assert.throws(function() { db.foo.findOne();}); - assert.throws(function() {db.getRole('testRole')}); + assert.throws(function() {db.getRole('testRole');}); assert.commandFailedWithCode(db.adminCommand('connPoolSync'), authzErrorCode); })(); diff --git a/jstests/auth/user_special_chars.js b/jstests/auth/user_special_chars.js index f4dc218aeb7..72fd06dff53 100644 --- a/jstests/auth/user_special_chars.js +++ b/jstests/auth/user_special_chars.js @@ -8,7 +8,7 @@ var testUserSpecialCharacters = function(){ roles: jsTest.adminUserRoles}); assert(adminDB.auth({user: '~`!@#$%^&*()-_+={}[]||;:",.//><', pwd: 'pass'})); -} +}; testUserSpecialCharacters(); MongoRunner.stopMongod(conn); |