summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/start_session_command.js
diff options
context:
space:
mode:
authorBen Shteinfeld <ben.shteinfeld@mongodb.com>2017-08-15 10:53:59 -0400
committerBen Shteinfeld <ben.shteinfeld@mongodb.com>2017-08-16 13:44:41 -0400
commit935a8bc840491b290b0924a6a6e1f323a0b242d0 (patch)
treea944238eba0bf7dd8ead08ea1caa3c235c594763 /jstests/noPassthrough/start_session_command.js
parentf5a7735f92136611b3158d8185727d540df8e94d (diff)
downloadmongo-935a8bc840491b290b0924a6a6e1f323a0b242d0.tar.gz
SERVER-28301 Add stats about the logical session record cache to the serverStatus command
Diffstat (limited to 'jstests/noPassthrough/start_session_command.js')
-rw-r--r--jstests/noPassthrough/start_session_command.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/jstests/noPassthrough/start_session_command.js b/jstests/noPassthrough/start_session_command.js
index 5b1b438c4b3..dfec1b69685 100644
--- a/jstests/noPassthrough/start_session_command.js
+++ b/jstests/noPassthrough/start_session_command.js
@@ -4,11 +4,15 @@
var admin;
var foo;
var result;
- var request = {startSession: 1};
+ const request = {startSession: 1};
conn = MongoRunner.runMongod({nojournal: ""});
admin = conn.getDB("admin");
+ // ensure that the cache is empty
+ var serverStatus = assert.commandWorked(admin.adminCommand({serverStatus: 1}));
+ assert.eq(0, serverStatus.logicalSessionRecordCache.records);
+
// test that we can run startSession unauthenticated when the server is running without --auth
result = admin.runCommand(request);
@@ -19,6 +23,10 @@
assert.eq(
result.timeoutMinutes, 30, "failed test that our session record has the correct timeout");
+ // test that startSession added to the cache
+ serverStatus = assert.commandWorked(admin.adminCommand({serverStatus: 1}));
+ assert.eq(1, serverStatus.logicalSessionRecordCache.records);
+
// test that we can run startSession authenticated when the server is running without --auth
admin.createUser({user: 'user0', pwd: 'password', roles: jsTest.basicUserRoles});
@@ -84,4 +92,5 @@
//
MongoRunner.stopMongod(conn);
+
})();