summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/clustered_capped_collection_arbitrary_key.js
blob: 1b369ba4d0447c8f513ea26d201b914b17387b6f (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
39
40
41
42
/**
 * Validate clustered capped collections.
 *
 * @tags: [
 *   requires_fcv_53,
 *   requires_replication,
 *   does_not_support_stepdowns,
 * ]
 */
(function() {
"use strict";

load("jstests/libs/clustered_collections/clustered_collection_util.js");
load("jstests/libs/clustered_collections/clustered_capped_utils.js");

const replSet = new ReplSetTest({name: "clustered_capped_collections", nodes: 1});
replSet.startSet({setParameter: {ttlMonitorSleepSecs: 1, supportArbitraryClusterKeyIndex: true}});
replSet.initiate();

const replicatedDB = replSet.getPrimary().getDB('replicated');
const nonReplicatedDB = replSet.getPrimary().getDB('local');
const collName = 'clustered_collection';
const replicatedColl = replicatedDB[collName];
const nonReplicatedColl = nonReplicatedDB[collName];

replicatedColl.drop();
nonReplicatedColl.drop();

ClusteredCappedUtils.testClusteredCappedCollectionWithTTL(nonReplicatedDB, collName, 'ts');
ClusteredCappedUtils.testClusteredTailableCursorCreation(
    nonReplicatedDB, collName, 'ts', false /* isReplicated */);
for (let awaitData of [false, true]) {
    ClusteredCappedUtils.testClusteredTailableCursorWithTTL(
        nonReplicatedDB, collName, 'ts', false /* isReplicated */, awaitData);
    ClusteredCappedUtils.testClusteredTailableCursorCappedPositionLostWithTTL(
        nonReplicatedDB, collName, 'ts', false /* isReplicated */, awaitData);
    ClusteredCappedUtils.testClusteredTailableCursorOutOfOrderInsertion(
        nonReplicatedDB, collName, 'ts', false /* isReplicated */, awaitData);
}

replSet.stopSet();
})();