diff options
author | Sara Golemon <sara.golemon@mongodb.com> | 2017-12-05 12:47:34 -0500 |
---|---|---|
committer | Sara Golemon <sara.golemon@mongodb.com> | 2017-12-12 15:37:52 -0500 |
commit | 0c0133f83aeb7930e90cb006e89cfce68aad2ad2 (patch) | |
tree | b35647cd1c79e2032189c8787d2b0cbe3892fec1 /jstests/auth/kill_cursors.js | |
parent | 2079d32e604fc3139bab4b4db7d2a9c748018a6a (diff) | |
download | mongo-0c0133f83aeb7930e90cb006e89cfce68aad2ad2.tar.gz |
SERVER-32169 Allow killCursors to kill across lsids
Diffstat (limited to 'jstests/auth/kill_cursors.js')
-rw-r--r-- | jstests/auth/kill_cursors.js | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/jstests/auth/kill_cursors.js b/jstests/auth/kill_cursors.js index 89523927235..146f3253282 100644 --- a/jstests/auth/kill_cursors.js +++ b/jstests/auth/kill_cursors.js @@ -29,20 +29,29 @@ }); } - // Create a cursor to be killed later. - loginAll(authUsers); - const id = assert.commandWorked(db.runCommand({find: db.coll.getName(), batchSize: 2})) - .cursor.id; - assert.neq(id, 0, "Invalid cursor ID"); - logoutAll(); - - loginAll(killUsers); - const killCmd = db.runCommand({killCursors: db.coll.getName(), cursors: [id]}); - logoutAll(); - if (shouldWork) { - assert.commandWorked(killCmd, "Unable to kill cursor"); - } else { - assert.commandFailed(killCmd, "Should not have been able to kill cursor"); + function doKill(extra) { + // Create a cursor to be killed later. + loginAll(authUsers); + let cmd = {find: db.coll.getName(), batchSize: 2}; + Object.assign(cmd, extra); + const id = assert.commandWorked(db.runCommand(cmd)).cursor.id; + assert.neq(id, 0, "Invalid cursor ID"); + logoutAll(); + + loginAll(killUsers); + const killCmd = db.runCommand({killCursors: db.coll.getName(), cursors: [id]}); + logoutAll(); + if (shouldWork) { + assert.commandWorked(killCmd, "Unable to kill cursor"); + } else { + assert.commandFailed(killCmd, "Should not have been able to kill cursor"); + } + } + + doKill({}); + if ((authUsers.length === 1) && (killUsers.length === 1)) { + // Session variant only makes sense with single auth'd users. + doKill({lsid: {id: BinData(4, "QlLfPHTySm6tqfuV+EOsVA==")}}); } } |