diff options
Diffstat (limited to 'jstests/core/list_all_local_sessions.js')
-rw-r--r-- | jstests/core/list_all_local_sessions.js | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/jstests/core/list_all_local_sessions.js b/jstests/core/list_all_local_sessions.js index 78189b1b324..72226dfbb08 100644 --- a/jstests/core/list_all_local_sessions.js +++ b/jstests/core/list_all_local_sessions.js @@ -11,34 +11,34 @@ // ] (function() { - 'use strict'; +'use strict'; - const admin = db.getSisterDB('admin'); +const admin = db.getSisterDB('admin'); - // Get current log level. - let originalLogLevel = assert.commandWorked(admin.setLogLevel(1)).was.verbosity; +// Get current log level. +let originalLogLevel = assert.commandWorked(admin.setLogLevel(1)).was.verbosity; - try { - const listAllLocalSessions = function() { - return admin.aggregate([{'$listLocalSessions': {allUsers: true}}]); - }; +try { + const listAllLocalSessions = function() { + return admin.aggregate([{'$listLocalSessions': {allUsers: true}}]); + }; - // Start a new session and capture its sessionId. - const myid = assert.commandWorked(db.runCommand({startSession: 1})).id.id; - assert(myid !== undefined); + // Start a new session and capture its sessionId. + const myid = assert.commandWorked(db.runCommand({startSession: 1})).id.id; + assert(myid !== undefined); - // Ensure that the cache now contains the session and is visible by admin. - const resultArray = assert.doesNotThrow(listAllLocalSessions).toArray(); - assert.gte(resultArray.length, 1); - const resultArrayMine = resultArray - .map(function(sess) { - return sess._id.id; - }) - .filter(function(id) { - return 0 == bsonWoCompare({x: id}, {x: myid}); - }); - assert.eq(resultArrayMine.length, 1); - } finally { - admin.setLogLevel(originalLogLevel); - } + // Ensure that the cache now contains the session and is visible by admin. + const resultArray = assert.doesNotThrow(listAllLocalSessions).toArray(); + assert.gte(resultArray.length, 1); + const resultArrayMine = resultArray + .map(function(sess) { + return sess._id.id; + }) + .filter(function(id) { + return 0 == bsonWoCompare({x: id}, {x: myid}); + }); + assert.eq(resultArrayMine.length, 1); +} finally { + admin.setLogLevel(originalLogLevel); +} })(); |