jstests/sharding/verify_sessions_expiration_sharded.js
/*
 * Refresh logical session cache on mongos and shard and check that each one of the session IDs in
 * the 'expectedSessionIDs' array exist. If 'expectToExist' is false, checks that they don't exist.
 */
Refresh logical session cache on mongos and shard and check that each one of the session IDs in
the 'expectedSessionIDs' array exist. If 'expectToExist' is false, checks that they don't exist.
Refresh logical session cache on mongos and shard and check that each one of the session IDs in the ' expectedSessionIDs ' array exist . If ' expectToExist ' is false checks that they don ' t exist .
function refreshSessionsAndVerifyExistence(
    mongosConfig, shardConfig, expectedSessionIDs, expectToExist = true) {
    mongosConfig.runCommand(refresh);
    shardConfig.runCommand(refresh);
    const sessionIDs = mongosConfig.system.sessions.find().toArray().map(s => s._id.id);
    assert(expectedSessionIDs.every(expectedId => {
        return sessionIDs.some(s => {
            return bsonBinaryEqual(s, expectedId);
        }) == expectToExist;
    }));
}
function refreshSessionsAndVerifyExistence ( mongosConfig , shardConfig , expectedSessionIDs , expectToExist = true ) { mongosConfig . runCommand ( refresh ) ; shardConfig . runCommand ( refresh ) ; const sessionIDs = mongosConfig . system . sessions . find ( ) . toArray ( ) . map ( s => s . _id . id ) ; assert ( expectedSessionIDs . every ( expectedId => { return sessionIDs . some ( s => { return bsonBinaryEqual ( s , expectedId ) ; } ) == expectToExist ; } ) ) ; }
Refresh logical session cache on mongos and shard and check that each one of the session IDs in
 the 'expectedSessionIDs' array exist.
Refresh logical session cache on mongos and shard and check that each one of the session IDs in the ' expectedSessionIDs ' array exist .
// Assert that 'expectedSessionIDs' is a subset of 'sessionIDs'