diff options
author | Pavi Vetriselvan <pavithra.vetriselvan@mongodb.com> | 2020-08-11 11:52:27 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-08-17 16:11:37 +0000 |
commit | e1daee88b3f4ef640e677143d210432e02a8fac2 (patch) | |
tree | 0cf2b8364c2c6743cac12d238aa856c1bc0373d0 /jstests/auth | |
parent | 2aaceb6fd0e5fbccbc2183138f37e45847d55cd3 (diff) | |
download | mongo-e1daee88b3f4ef640e677143d210432e02a8fac2.tar.gz |
SERVER-49996 Ensure getSiblingDB() is used instead of getSisterDB()
Diffstat (limited to 'jstests/auth')
-rw-r--r-- | jstests/auth/auth1.js | 10 | ||||
-rw-r--r-- | jstests/auth/lib/commands_lib.js | 106 | ||||
-rw-r--r-- | jstests/auth/mr_auth.js | 6 | ||||
-rw-r--r-- | jstests/auth/profile.js | 2 | ||||
-rw-r--r-- | jstests/auth/user_cache_doc_source.js | 2 |
5 files changed, 63 insertions, 63 deletions
diff --git a/jstests/auth/auth1.js b/jstests/auth/auth1.js index 64ab9d661ce..4498c9acc23 100644 --- a/jstests/auth/auth1.js +++ b/jstests/auth/auth1.js @@ -20,8 +20,8 @@ function runTest(m) { dbRO = mro.getDB("test"); tRO = dbRO[baseName]; - db.getSisterDB("admin").createUser({user: "root", pwd: "root", roles: ["root"]}); - db.getSisterDB("admin").auth("root", "root"); + db.getSiblingDB("admin").createUser({user: "root", pwd: "root", roles: ["root"]}); + db.getSiblingDB("admin").auth("root", "root"); t = db[baseName]; t.drop(); @@ -29,11 +29,11 @@ function runTest(m) { db.dropAllUsers(); db.logout(); - db.getSisterDB("admin").createUser({user: "super", pwd: "super", roles: ["__system"]}); - db.getSisterDB("admin").auth("super", "super"); + db.getSiblingDB("admin").createUser({user: "super", pwd: "super", roles: ["__system"]}); + db.getSiblingDB("admin").auth("super", "super"); db.createUser({user: "eliot", pwd: "eliot", roles: jsTest.basicUserRoles}); db.createUser({user: "guest", pwd: "guest", roles: jsTest.readOnlyUserRoles}); - db.getSisterDB("admin").logout(); + db.getSiblingDB("admin").logout(); assert.throws(function() { t.findOne(); diff --git a/jstests/auth/lib/commands_lib.js b/jstests/auth/lib/commands_lib.js index 253113ee08a..c26c125f81f 100644 --- a/jstests/auth/lib/commands_lib.js +++ b/jstests/auth/lib/commands_lib.js @@ -282,10 +282,10 @@ var authCommandsLib = { }, skipSharded: true, setup: function(db) { - assert.writeOK(db.getSisterDB(firstDbName).x.save({})); + assert.writeOK(db.getSiblingDB(firstDbName).x.save({})); }, teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); + db.getSiblingDB(firstDbName).x.drop(); }, testcases: [ { @@ -314,7 +314,7 @@ var authCommandsLib = { }, skipSharded: true, teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); + db.getSiblingDB(firstDbName).x.drop(); }, testcases: [ { @@ -350,7 +350,7 @@ var authCommandsLib = { }, skipSharded: true, teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); + db.getSiblingDB(firstDbName).x.drop(); }, testcases: [ { @@ -377,7 +377,7 @@ var authCommandsLib = { }, skipSharded: true, teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); + db.getSiblingDB(firstDbName).x.drop(); }, testcases: [{ expectAuthzFailure: true, @@ -402,10 +402,10 @@ var authCommandsLib = { }, skipSharded: true, setup: function(db) { - assert.writeOK(db.getSisterDB(firstDbName).x.save({})); + assert.writeOK(db.getSiblingDB(firstDbName).x.save({})); }, teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); + db.getSiblingDB(firstDbName).x.drop(); }, testcases: [ { @@ -442,7 +442,7 @@ var authCommandsLib = { }, skipSharded: true, setup: function(db) { - var sibling = db.getSisterDB(firstDbName); + var sibling = db.getSiblingDB(firstDbName); assert.commandWorked(sibling.runCommand({create: "x"})); return { @@ -451,7 +451,7 @@ var authCommandsLib = { }; }, teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); + db.getSiblingDB(firstDbName).x.drop(); }, testcases: [ { @@ -480,7 +480,7 @@ var authCommandsLib = { }, skipSharded: true, setup: function(db) { - var sibling = db.getSisterDB(firstDbName); + var sibling = db.getSiblingDB(firstDbName); assert.commandWorked(sibling.runCommand({create: "x"})); return { @@ -489,7 +489,7 @@ var authCommandsLib = { }; }, teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); + db.getSiblingDB(firstDbName).x.drop(); }, testcases: [ { @@ -538,11 +538,11 @@ var authCommandsLib = { }, skipSharded: true, setup: function(db) { - assert.writeOK(db.getSisterDB(firstDbName).x.save({})); + assert.writeOK(db.getSiblingDB(firstDbName).x.save({})); }, teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); - db.getSisterDB(secondDbName).y.drop(); + db.getSiblingDB(firstDbName).x.drop(); + db.getSiblingDB(secondDbName).y.drop(); }, testcases: [ { @@ -572,10 +572,10 @@ var authCommandsLib = { }, skipSharded: true, setup: function(db) { - assert.writeOK(db.getSisterDB(firstDbName).x.save({})); + assert.writeOK(db.getSiblingDB(firstDbName).x.save({})); }, teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); + db.getSiblingDB(firstDbName).x.drop(); }, testcases: [ { @@ -601,7 +601,7 @@ var authCommandsLib = { }, skipSharded: true, setup: function(db) { - var sibling = db.getSisterDB(firstDbName); + var sibling = db.getSiblingDB(firstDbName); assert.commandWorked(sibling.runCommand({create: "x"})); return { @@ -610,7 +610,7 @@ var authCommandsLib = { }; }, teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); + db.getSiblingDB(firstDbName).x.drop(); }, testcases: [ { @@ -638,7 +638,7 @@ var authCommandsLib = { }, skipSharded: true, setup: function(db) { - var sibling = db.getSisterDB(firstDbName); + var sibling = db.getSiblingDB(firstDbName); assert.commandWorked(sibling.runCommand({create: "x"})); return { @@ -647,7 +647,7 @@ var authCommandsLib = { }; }, teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); + db.getSiblingDB(firstDbName).x.drop(); }, testcases: [ { @@ -677,7 +677,7 @@ var authCommandsLib = { }, skipSharded: true, setup: function(db) { - var sibling = db.getSisterDB(firstDbName); + var sibling = db.getSiblingDB(firstDbName); assert.commandWorked(sibling.runCommand({create: "x"})); return { @@ -686,7 +686,7 @@ var authCommandsLib = { }; }, teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); + db.getSiblingDB(firstDbName).x.drop(); }, testcases: [ { @@ -723,10 +723,10 @@ var authCommandsLib = { }, skipSharded: true, setup: function(db) { - db.getSisterDB(firstDbName).x.drop(); + db.getSiblingDB(firstDbName).x.drop(); }, teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); + db.getSiblingDB(firstDbName).x.drop(); }, testcases: [ { @@ -756,15 +756,15 @@ var authCommandsLib = { }, skipSharded: true, setup: function(db) { - db.getSisterDB(firstDbName).x.drop(); - db.getSisterDB(firstDbName).y.drop(); - var sibling = db.getSisterDB(firstDbName); + db.getSiblingDB(firstDbName).x.drop(); + db.getSiblingDB(firstDbName).y.drop(); + var sibling = db.getSiblingDB(firstDbName); assert.commandWorked(sibling.runCommand({create: "x"})); assert.commandWorked(sibling.runCommand({create: "y"})); return {x_uuid: getUUIDFromListCollections(sibling, sibling.x.getName())}; }, teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); + db.getSiblingDB(firstDbName).x.drop(); }, testcases: [ { @@ -795,15 +795,15 @@ var authCommandsLib = { }, skipSharded: true, setup: function(db) { - db.getSisterDB(firstDbName).x.drop(); - db.getSisterDB(firstDbName).y.drop(); - var sibling = db.getSisterDB(firstDbName); + db.getSiblingDB(firstDbName).x.drop(); + db.getSiblingDB(firstDbName).y.drop(); + var sibling = db.getSiblingDB(firstDbName); assert.commandWorked(sibling.runCommand({create: "x"})); assert.commandWorked(sibling.runCommand({create: "y"})); return {x_uuid: getUUIDFromListCollections(sibling, sibling.x.getName())}; }, teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); + db.getSiblingDB(firstDbName).x.drop(); }, testcases: [ { @@ -832,10 +832,10 @@ var authCommandsLib = { }, skipSharded: true, setup: function(db) { - assert.writeOK(db.getSisterDB(firstDbName).x.save({_id: 1, data: 1})); + assert.writeOK(db.getSiblingDB(firstDbName).x.save({_id: 1, data: 1})); }, teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); + db.getSiblingDB(firstDbName).x.drop(); }, testcases: [ { @@ -860,10 +860,10 @@ var authCommandsLib = { }, skipSharded: true, setup: function(db) { - assert.writeOK(db.getSisterDB(firstDbName).x.save({_id: 1, data: 1})); + assert.writeOK(db.getSiblingDB(firstDbName).x.save({_id: 1, data: 1})); }, teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); + db.getSiblingDB(firstDbName).x.drop(); }, testcases: [ { @@ -891,7 +891,7 @@ var authCommandsLib = { }, skipSharded: true, setup: function(db) { - var sibling = db.getSisterDB(firstDbName); + var sibling = db.getSiblingDB(firstDbName); assert.writeOK(sibling.x.save({_id: 1, data: 1})); return { @@ -900,7 +900,7 @@ var authCommandsLib = { }; }, teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); + db.getSiblingDB(firstDbName).x.drop(); }, testcases: [ { @@ -929,7 +929,7 @@ var authCommandsLib = { }, skipSharded: true, setup: function(db) { - var sibling = db.getSisterDB(firstDbName); + var sibling = db.getSiblingDB(firstDbName); assert.writeOK(sibling.x.save({_id: 1, data: 1})); return { @@ -938,7 +938,7 @@ var authCommandsLib = { }; }, teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); + db.getSiblingDB(firstDbName).x.drop(); }, testcases: [ { @@ -955,10 +955,10 @@ var authCommandsLib = { command: {applyOps: [{"op": "d", "ns": firstDbName + ".x", "o": {"_id": 1}}]}, skipSharded: true, setup: function(db) { - assert.writeOK(db.getSisterDB(firstDbName).x.save({_id: 1, data: 1})); + assert.writeOK(db.getSiblingDB(firstDbName).x.save({_id: 1, data: 1})); }, teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); + db.getSiblingDB(firstDbName).x.drop(); }, testcases: [ { @@ -4900,11 +4900,11 @@ var authCommandsLib = { testname: "renameCollection_sameDb", command: {renameCollection: firstDbName + ".x", to: firstDbName + ".y", dropTarget: true}, setup: function(db) { - assert.writeOK(db.getSisterDB(firstDbName).x.save({})); + assert.writeOK(db.getSiblingDB(firstDbName).x.save({})); }, teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); - db.getSisterDB(firstDbName).y.drop(); + db.getSiblingDB(firstDbName).x.drop(); + db.getSiblingDB(firstDbName).y.drop(); }, testcases: [ { @@ -4928,11 +4928,11 @@ var authCommandsLib = { testname: "renameCollection_sameDb_failure", command: {renameCollection: firstDbName + ".x", to: firstDbName + ".y"}, setup: function(db) { - assert.writeOK(db.getSisterDB(firstDbName).x.save({})); + assert.writeOK(db.getSiblingDB(firstDbName).x.save({})); }, teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); - db.getSisterDB(firstDbName).y.drop(); + db.getSiblingDB(firstDbName).x.drop(); + db.getSiblingDB(firstDbName).y.drop(); }, testcases: [ { @@ -4952,20 +4952,20 @@ var authCommandsLib = { testname: "renameCollection_twoDbs", command: {renameCollection: firstDbName + ".x", to: secondDbName + ".y"}, setup: function(db) { - assert.writeOK(db.getSisterDB(firstDbName).x.save({})); + assert.writeOK(db.getSiblingDB(firstDbName).x.save({})); // Running movePrimary is necessary on mongos, but doesn't exist on non-sharded // systems. if (db.getMongo().isMongos()) { assert.commandWorked( - db.getSisterDB(adminDbName).runCommand({movePrimary: firstDbName, to: shard0name})); + db.getSiblingDB(adminDbName).runCommand({movePrimary: firstDbName, to: shard0name})); assert.commandWorked( - db.getSisterDB(adminDbName).runCommand({movePrimary: secondDbName, to: shard0name})); + db.getSiblingDB(adminDbName).runCommand({movePrimary: secondDbName, to: shard0name})); } }, teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); - db.getSisterDB(secondDbName).y.drop(); + db.getSiblingDB(firstDbName).x.drop(); + db.getSiblingDB(secondDbName).y.drop(); }, testcases: [ { diff --git a/jstests/auth/mr_auth.js b/jstests/auth/mr_auth.js index 1adc66ea7fa..9c398af1ba1 100644 --- a/jstests/auth/mr_auth.js +++ b/jstests/auth/mr_auth.js @@ -32,11 +32,11 @@ for (var i = 0; i < 1000; i++) assert.eq(1000, t.count(), "inserts failed"); d.dropAllUsers(); -d.getSisterDB("admin").createUser({user: "admin", pwd: "admin", roles: jsTest.adminUserRoles}); -d.getSisterDB("admin").auth('admin', 'admin'); +d.getSiblingDB("admin").createUser({user: "admin", pwd: "admin", roles: jsTest.adminUserRoles}); +d.getSiblingDB("admin").auth('admin', 'admin'); d.createUser({user: "write", pwd: "write", roles: jsTest.basicUserRoles}); d.createUser({user: "read", pwd: "read", roles: jsTest.readOnlyUserRoles}); -d.getSisterDB("admin").logout(); +d.getSiblingDB("admin").logout(); t.mapReduce(map, red, {out: {inline: 1}}); diff --git a/jstests/auth/profile.js b/jstests/auth/profile.js index 1b63133edbc..3c88b37ad29 100644 --- a/jstests/auth/profile.js +++ b/jstests/auth/profile.js @@ -2,7 +2,7 @@ // @tags: [requires_profiling] var conn = MongoRunner.runMongod(); var db1 = conn.getDB("profile-a"); -var db2 = db1.getSisterDB("profile-b"); +var db2 = db1.getSiblingDB("profile-b"); var username = "user"; db1.createUser({user: username, pwd: "password", roles: jsTest.basicUserRoles}); db2.createUser({user: username, pwd: "password", roles: jsTest.basicUserRoles}); diff --git a/jstests/auth/user_cache_doc_source.js b/jstests/auth/user_cache_doc_source.js index 90378b18562..a4b57eb66ae 100644 --- a/jstests/auth/user_cache_doc_source.js +++ b/jstests/auth/user_cache_doc_source.js @@ -31,7 +31,7 @@ newConn.close(); */ var awaitShell = startParallelShell(function() { - assert.eq(db.getSisterDB("admin").auth("readOnlyUser", "foobar"), 1); + assert.eq(db.getSiblingDB("admin").auth("readOnlyUser", "foobar"), 1); }, mongod.port); const expectedReadOnlyInactive = [ |