summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough
diff options
context:
space:
mode:
authorEric Cox <eric.cox@mongodb.com>2022-06-22 14:21:07 +0000
committerEric Cox <eric.cox@mongodb.com>2022-06-22 14:21:07 +0000
commit44385b89a690f1feda55d8e888a08f33eab0a020 (patch)
tree6ec320d4c7de3e7ff00231aec91106f844701cc3 /jstests/noPassthrough
parente24af2270e6bc1d435845c8fdd02a1eb24155da2 (diff)
downloadmongo-44385b89a690f1feda55d8e888a08f33eab0a020.tar.gz
Revert "Merge branch 'v6.0' of github.com:10gen/mongo into v6.0"
This reverts commit e24af2270e6bc1d435845c8fdd02a1eb24155da2, reversing changes made to ecf315a92efb6283a4c8f3fd079dd81398563fa6.
Diffstat (limited to 'jstests/noPassthrough')
-rw-r--r--jstests/noPassthrough/list_local_sessions.js93
1 files changed, 0 insertions, 93 deletions
diff --git a/jstests/noPassthrough/list_local_sessions.js b/jstests/noPassthrough/list_local_sessions.js
deleted file mode 100644
index 60b73f7f6ad..00000000000
--- a/jstests/noPassthrough/list_local_sessions.js
+++ /dev/null
@@ -1,93 +0,0 @@
-// Basic tests for the $listLocalSessions aggregation stage.
-//
-// @tags: [
-// # This test attempts to start a session and find it using the $listLocalSessions stage. The
-// # former operation must be routed to the primary in a replica set, whereas the latter may be
-// # routed to a secondary.
-// assumes_read_preference_unchanged,
-// # Sessions are asynchronously flushed to disk, so a stepdown immediately after calling
-// # startSession may cause this test to fail to find the returned sessionId.
-// does_not_support_stepdowns,
-// requires_sharding,
-// ]
-
-(function() {
-'use strict';
-
-const st = new ShardingTest({
- shards: 1,
- mongos: 1,
- other: {mongosOptions: {setParameter: {disableLogicalSessionCacheRefresh: true}}}
-});
-
-const admin = st.s.getDB("admin");
-
-function listLocalSessions() {
- return admin.aggregate([{'$listLocalSessions': {allUsers: false}}]);
-}
-
-// Get current log level.
-let originalLogLevel = assert.commandWorked(admin.setLogLevel(1)).was.verbosity;
-
-try {
- // Start a new session and capture its sessionId.
- const myid = assert.commandWorked(st.s.adminCommand({startSession: 1})).id.id;
- assert(myid !== undefined);
-
- // Ensure that the cache now contains the session and is visible.
- const resultArray = assert.doesNotThrow(listLocalSessions).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);
-
- // Try asking for the session by username.
- const myusername = (function() {
- if (0 == bsonWoCompare({x: resultArray[0]._id.uid}, {x: computeSHA256Block("")})) {
- // Code for "we're running in no-auth mode"
- return {user: "", db: ""};
- }
- const connstats = assert.commandWorked(db.runCommand({connectionStatus: 1}));
- const authUsers = connstats.authInfo.authenticatedUsers;
- assert(authUsers !== undefined);
- assert.eq(authUsers.length, 1);
- assert(authUsers[0].user !== undefined);
- assert(authUsers[0].db !== undefined);
- return {user: authUsers[0].user, db: authUsers[0].db};
- })();
-
- const listMyLocalSessions = function() {
- return admin.aggregate([{'$listLocalSessions': {users: [myusername]}}]);
- };
-
- const myArray = assert.doesNotThrow(listMyLocalSessions)
- .toArray()
- .map(function(sess) {
- return sess._id.id;
- })
- .filter(function(id) {
- return 0 == bsonWoCompare({x: id}, {x: myid});
- });
- assert.eq(myArray.length, 1);
-
- print("sessions returned from $listLocalSessions filtered by user: [ " + myArray +
- " ]");
- print("sessions returned from un-filtered $listLocalSessions for this user: [ " +
- resultArrayMine + " ]");
-
- assert.eq(
- 0,
- bsonWoCompare(myArray, resultArrayMine),
- "set of listed sessions for user contains different sessions from prior $listLocalSessions run");
-
-} finally {
- admin.setLogLevel(originalLogLevel);
-}
-
-st.stop();
-})();