blob: 21eb3d221a30ec491633ece8aae75db8f96c0824 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
load('jstests/libs/sessions_collection.js');
(function() {
"use strict";
// This test makes assertions about the number of sessions, which are not compatible with
// implicit sessions.
TestData.disableImplicitSessions = true;
var startSession = {startSession: 1};
var conn = MongoRunner.runMongod({nojournal: ""});
var admin = conn.getDB("admin");
var config = conn.getDB("config");
// Test that we can use sessions before the sessions collection exists.
{
validateSessionsCollection(conn, false, false);
assert.commandWorked(admin.runCommand({startSession: 1}));
validateSessionsCollection(conn, false, false);
}
// Test that a refresh will create the sessions collection.
{
assert.commandWorked(admin.runCommand({refreshLogicalSessionCacheNow: 1}));
validateSessionsCollection(conn, true, true);
}
// Test that a refresh will (re)create the TTL index on the sessions collection.
{
assert.commandWorked(config.system.sessions.dropIndex({lastUse: 1}));
validateSessionsCollection(conn, true, false);
assert.commandWorked(admin.runCommand({refreshLogicalSessionCacheNow: 1}));
validateSessionsCollection(conn, true, true);
}
MongoRunner.stopMongod(conn);
})();
|