summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authornandinibhartiyaMDB <nandini.bhartiya@mongodb.com>2022-06-16 15:44:09 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-06-16 17:25:54 +0000
commit8f0a435d75de0a503104ff984362180018a7f663 (patch)
tree39b6f39e661e74b612e490d77541aec76489ae07 /jstests
parente2b75378f0460e1cceec4dcb2120d104cdc24ece (diff)
downloadmongo-8f0a435d75de0a503104ff984362180018a7f663.tar.gz
SERVER-61812: Ensure cache is not refreshed during $listLocalSessions
Diffstat (limited to 'jstests')
-rw-r--r--jstests/libs/parallelTester.js1
-rw-r--r--jstests/noPassthrough/list_local_sessions.js (renamed from jstests/core/list_local_sessions.js)14
2 files changed, 12 insertions, 3 deletions
diff --git a/jstests/libs/parallelTester.js b/jstests/libs/parallelTester.js
index e6bf0a29498..bb77debbd59 100644
--- a/jstests/libs/parallelTester.js
+++ b/jstests/libs/parallelTester.js
@@ -315,7 +315,6 @@ if (typeof _threadInject != "undefined") {
// run in parallel, they could interfere with the cache and cause failures.
parallelFilesDir + "/list_all_local_sessions.js",
parallelFilesDir + "/list_all_sessions.js",
- parallelFilesDir + "/list_local_sessions.js",
parallelFilesDir + "/list_sessions.js",
];
var serialTests = makeKeys(serialTestsArr);
diff --git a/jstests/core/list_local_sessions.js b/jstests/noPassthrough/list_local_sessions.js
index bee5c084ca7..60b73f7f6ad 100644
--- a/jstests/core/list_local_sessions.js
+++ b/jstests/noPassthrough/list_local_sessions.js
@@ -8,12 +8,20 @@
// # 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 admin = db.getSiblingDB('admin');
+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}}]);
}
@@ -23,7 +31,7 @@ let originalLogLevel = assert.commandWorked(admin.setLogLevel(1)).was.verbosity;
try {
// Start a new session and capture its sessionId.
- const myid = assert.commandWorked(db.runCommand({startSession: 1})).id.id;
+ 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.
@@ -80,4 +88,6 @@ try {
} finally {
admin.setLogLevel(originalLogLevel);
}
+
+st.stop();
})();