summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/config_transactions_reads.js
blob: d5ec5dd5f927d89e2460867e19cd0e562dbb8b3b (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
/* Test that snapshot reads and afterClusterTime majority reads are not allowed on
 * config.transactions.
 *
 * @tags: [
 *   requires_majority_read_concern,
 *   requires_persistence,
 *   requires_replication,
 * ]
 */
(function() {
"use strict";

const replSet = new ReplSetTest({nodes: 1});

replSet.startSet();
replSet.initiate();

const primary = replSet.getPrimary();
const primaryDB = primary.getDB('config');

const operationTime =
    assert.commandWorked(primaryDB.runCommand({find: "transactions"})).operationTime;
assert.commandWorked(
    primaryDB.runCommand({find: "transactions", readConcern: {level: "majority"}}));
assert.commandFailedWithCode(
    primaryDB.runCommand(
        {find: "transactions", readConcern: {level: "majority", afterClusterTime: operationTime}}),
    5557800);
assert.commandFailedWithCode(
    primaryDB.runCommand({find: "transactions", readConcern: {level: "snapshot"}}), 5557800);
assert.commandFailedWithCode(
    primaryDB.runCommand(
        {find: "transactions", readConcern: {level: "snapshot", atClusterTime: operationTime}}),
    5557800);

replSet.stopSet();
})();