diff options
author | William Schultz <william.schultz@mongodb.com> | 2019-07-02 17:22:53 -0400 |
---|---|---|
committer | William Schultz <william.schultz@mongodb.com> | 2019-08-13 16:58:17 -0400 |
commit | a9df903dfdd072f270021f34af4d59de87fb30ea (patch) | |
tree | 9e0e82b640fe22dd9ee82cbd90b0b9ccff571a96 /jstests/auth | |
parent | 4605de0e64aa4e57487e620f91e5de52615a1941 (diff) | |
download | mongo-a9df903dfdd072f270021f34af4d59de87fb30ea.tar.gz |
SERVER-39576 Remove the 'doTxn' command
(cherry picked from commit 285c39607ee33aea0d6aff15cfaca37d0956ab50)
Diffstat (limited to 'jstests/auth')
-rw-r--r-- | jstests/auth/lib/commands_lib.js | 429 |
1 files changed, 0 insertions, 429 deletions
diff --git a/jstests/auth/lib/commands_lib.js b/jstests/auth/lib/commands_lib.js index 71c2fb17b61..dbde9b9f138 100644 --- a/jstests/auth/lib/commands_lib.js +++ b/jstests/auth/lib/commands_lib.js @@ -3248,435 +3248,6 @@ var authCommandsLib = { ] }, { - testname: "doTxn_precondition", - command: { - doTxn: [{ - "op": "i", - "ns": firstDbName + ".x", - "o": {"_id": ObjectId("57dc3d7da4fce4358afa85b8"), "data": 5} - }], - preCondition: [{ns: firstDbName + ".x", q: {x: 5}, res: []}], - txnNumber: NumberLong(0), - lsid: {id: UUID()} - }, - skipSharded: true, - skipUnlessReplicaSet: true, - setup: function(db) { - db.getSisterDB(firstDbName).x.save({}); - }, - teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); - }, - testcases: [ - { - runOnDb: adminDbName, - privileges: [ - {resource: {db: firstDbName, collection: "x"}, actions: ["find"]}, - {resource: {db: firstDbName, collection: "x"}, actions: ["insert"]}, - ], - }, - ] - }, - { - testname: "doTxn_insert", - command: { - doTxn: [{ - "op": "i", - "ns": firstDbName + ".x", - "o": {"_id": ObjectId("57dc3d7da4fce4358afa85b8"), "data": 5} - }], - txnNumber: NumberLong(0), - lsid: {id: UUID()} - }, - skipSharded: true, - skipUnlessReplicaSet: true, - setup: function(db) { - db.getSisterDB(firstDbName).x.save({}); - }, - teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); - }, - testcases: [ - { - runOnDb: adminDbName, - roles: roles_write, - privileges: [ - {resource: {db: firstDbName, collection: "x"}, actions: ["insert"]}, - ], - }, - ] - }, - { - testname: "doTxn_insert_UUID", - command: function(state) { - return { - doTxn: [{ - "op": "i", - "ns": state.collName, - "ui": state.uuid, - "o": {"_id": ObjectId("57dc3d7da4fce4358afa85b8"), "data": 5} - }], - txnNumber: NumberLong(0), - lsid: {id: UUID()} - }; - }, - skipSharded: true, - skipUnlessReplicaSet: true, - setup: function(db) { - var sibling = db.getSisterDB(firstDbName); - sibling.runCommand({create: "x"}); - - return { - collName: sibling.x.getFullName(), - uuid: getUUIDFromListCollections(sibling, sibling.x.getName()) - }; - }, - teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); - }, - testcases: [ - { - runOnDb: adminDbName, - roles: {root: 1, restore: 1, __system: 1}, - privileges: [ - {resource: {db: firstDbName, collection: "x"}, actions: ["insert"]}, - {resource: {cluster: true}, actions: ["useUUID"]} - ], - }, - ] - }, - { - testname: "doTxn_insert_with_nonexistent_UUID", - command: function(state) { - return { - doTxn: [{ - "op": "i", - "ns": state.collName, - // Given a nonexistent UUID. The command should fail. - "ui": UUID("71f1d1d7-68ca-493e-a7e9-f03c94e2e960"), - "o": {"_id": ObjectId("57dc3d7da4fce4358afa85b8"), "data": 5} - }], - txnNumber: NumberLong(0), - lsid: {id: UUID()} - }; - }, - skipSharded: true, - skipUnlessReplicaSet: true, - setup: function(db) { - var sibling = db.getSisterDB(firstDbName); - sibling.runCommand({create: "x"}); - - return { - collName: sibling.x.getFullName(), - uuid: getUUIDFromListCollections(sibling, sibling.x.getName()) - }; - }, - teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); - }, - testcases: [ - { - // It would be an sanity check failure rather than a auth check - // failure. - expectFail: true, - runOnDb: adminDbName, - roles: {root: 1, restore: 1, __system: 1}, - privileges: [ - {resource: {db: firstDbName, collection: "x"}, actions: ["insert"]}, - {resource: {cluster: true}, actions: ["useUUID"]} - ], - }, - ] - }, - { - testname: "doTxn_insert_UUID_failure", - command: function(state) { - return { - doTxn: [{ - "op": "i", - "ns": state.collName, - "ui": state.uuid, - "o": {"_id": ObjectId("57dc3d7da4fce4358afa85b8"), "data": 5} - }], - txnNumber: NumberLong(0), - lsid: {id: UUID()} - }; - }, - skipSharded: true, - skipUnlessReplicaSet: true, - setup: function(db) { - var sibling = db.getSisterDB(firstDbName); - sibling.runCommand({create: "x"}); - - return { - collName: sibling.x.getFullName(), - uuid: getUUIDFromListCollections(sibling, sibling.x.getName()) - }; - }, - teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); - }, - testcases: [ - { - expectAuthzFailure: true, - runOnDb: adminDbName, - privileges: [ - {resource: {db: firstDbName, collection: "x"}, actions: ["insert"]}, - // Don't have useUUID privilege. - ], - }, - ] - }, - { - testname: "doTxn_insert_UUID_with_wrong_ns", - command: function(state) { - return { - doTxn: [{ - "op": "i", - "ns": - firstDbName + ".y", // Specify wrong name but correct uuid. Should work. - "ui": state.x_uuid, // The insert should on x - "o": {"_id": ObjectId("57dc3d7da4fce4358afa85b8"), "data": 5} - }], - txnNumber: NumberLong(0), - lsid: {id: UUID()} - }; - }, - skipSharded: true, - skipUnlessReplicaSet: true, - setup: function(db) { - db.getSisterDB(firstDbName).x.drop(); - db.getSisterDB(firstDbName).y.drop(); - var sibling = db.getSisterDB(firstDbName); - sibling.runCommand({create: "x"}); - sibling.runCommand({create: "y"}); - return {x_uuid: getUUIDFromListCollections(sibling, sibling.x.getName())}; - }, - teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); - }, - testcases: [ - { - runOnDb: adminDbName, - privileges: [ - { - resource: {db: firstDbName, collection: "x"}, - actions: ["createCollection", "insert"] - }, - {resource: {db: firstDbName, collection: "y"}, actions: ["createCollection"]}, - {resource: {cluster: true}, actions: ["useUUID", "forceUUID"]} - ], - }, - ] - }, - { - testname: "doTxn_insert_UUID_with_wrong_ns_failure", - command: function(state) { - return { - doTxn: [{ - "op": "i", - "ns": - firstDbName + ".y", // Specify wrong name but correct uuid. Should work. - "ui": state.x_uuid, // The insert should on x - "o": {"_id": ObjectId("57dc3d7da4fce4358afa85b8"), "data": 5} - }], - txnNumber: NumberLong(0), - lsid: {id: UUID()} - }; - }, - skipSharded: true, - skipUnlessReplicaSet: true, - setup: function(db) { - db.getSisterDB(firstDbName).x.drop(); - db.getSisterDB(firstDbName).y.drop(); - var sibling = db.getSisterDB(firstDbName); - sibling.runCommand({create: "x"}); - sibling.runCommand({create: "y"}); - return {x_uuid: getUUIDFromListCollections(sibling, sibling.x.getName())}; - }, - teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); - }, - testcases: [ - { - expectAuthzFailure: true, - runOnDb: adminDbName, - privileges: [ - {resource: {db: firstDbName, collection: "x"}, actions: ["createCollection"]}, - { - resource: {db: firstDbName, collection: "y"}, - actions: ["createCollection", "insert"] - }, - {resource: {cluster: true}, actions: ["useUUID", "forceUUID"]} - ], - }, - ] - }, - { - testname: "doTxn_upsert", - command: { - doTxn: [{ - "op": "u", - "ns": firstDbName + ".x", - "o2": {"_id": 1}, - "o": {"_id": 1, "data": 8} - }], - txnNumber: NumberLong(0), - lsid: {id: UUID()} - }, - skipSharded: true, - skipUnlessReplicaSet: true, - setup: function(db) { - db.getSisterDB(firstDbName).x.save({_id: 1, data: 1}); - }, - teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); - }, - testcases: [ - { - runOnDb: adminDbName, - roles: Object.merge(roles_write, {restore: 0}, true), - privileges: [ - {resource: {db: firstDbName, collection: "x"}, actions: ["update", "insert"]}, - ], - }, - ] - }, - { - testname: "doTxn_update", - command: { - doTxn: [{ - "op": "u", - "ns": firstDbName + ".x", - "o2": {"_id": 1}, - "o": {"_id": 1, "data": 8} - }], - txnNumber: NumberLong(0), - lsid: {id: UUID()} - }, - skipSharded: true, - skipUnlessReplicaSet: true, - setup: function(db) { - db.getSisterDB(firstDbName).x.save({_id: 1, data: 1}); - }, - teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); - }, - testcases: [ - { - runOnDb: adminDbName, - roles: Object.merge(roles_write, {restore: 0}, true), - privileges: [ - {resource: {db: firstDbName, collection: "x"}, actions: ["update"]}, - ], - }, - ] - }, - { - testname: "doTxn_update_UUID", - command: function(state) { - return { - doTxn: [{ - "op": "u", - "ns": state.collName, - "ui": state.uuid, - "o2": {"_id": 1}, - "o": {"_id": 1, "data": 8} - }], - txnNumber: NumberLong(0), - lsid: {id: UUID()} - }; - }, - skipSharded: true, - skipUnlessReplicaSet: true, - setup: function(db) { - var sibling = db.getSisterDB(firstDbName); - sibling.x.save({_id: 1, data: 1}); - - return { - collName: sibling.x.getFullName(), - uuid: getUUIDFromListCollections(sibling, sibling.x.getName()) - }; - }, - teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); - }, - testcases: [ - { - runOnDb: adminDbName, - roles: {root: 1, __system: 1}, - privileges: [ - {resource: {db: firstDbName, collection: "x"}, actions: ["update"]}, - {resource: {cluster: true}, actions: ["useUUID"]} - ], - }, - ] - }, - { - testname: "doTxn_update_UUID_failure", - command: function(state) { - return { - doTxn: [{ - "op": "u", - "ns": state.collName, - "ui": state.uuid, - "o2": {"_id": 1}, - "o": {"_id": 1, "data": 8} - }], - txnNumber: NumberLong(0), - lsid: {id: UUID()} - }; - }, - skipSharded: true, - skipUnlessReplicaSet: true, - setup: function(db) { - var sibling = db.getSisterDB(firstDbName); - sibling.x.save({_id: 1, data: 1}); - - return { - collName: sibling.x.getFullName(), - uuid: getUUIDFromListCollections(sibling, sibling.x.getName()) - }; - }, - teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); - }, - testcases: [ - { - expectAuthzFailure: true, - runOnDb: adminDbName, - privileges: [ - {resource: {db: firstDbName, collection: "x"}, actions: ["update"]}, - ], - }, - ] - }, - { - testname: "doTxn_delete", - command: { - doTxn: [{"op": "d", "ns": firstDbName + ".x", "o": {"_id": 1}}], - txnNumber: NumberLong(0), - lsid: {id: UUID()} - }, - skipSharded: true, - skipUnlessReplicaSet: true, - setup: function(db) { - db.getSisterDB(firstDbName).x.save({_id: 1, data: 1}); - }, - teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); - }, - testcases: [ - { - runOnDb: adminDbName, - roles: Object.merge(roles_write, {restore: 0}, true), - privileges: [ - {resource: {db: firstDbName, collection: "x"}, actions: ["remove"]}, - ], - }, - ] - }, - { testname: "drop", command: {drop: "x"}, setup: function(db) { |