summaryrefslogtreecommitdiff
path: root/jstests/noPassthroughWithMongod/shell_advance_cluster_time.js
blob: db3c49048961dcef3653150893ef7eaf6d6d4fed (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
/**
 * Santity check getClusterTime and advanceClusterTime.
 */

(function() {
    assert.throws(function() {
        db.getMongo().advanceClusterTime();
    });

    assert.throws(function() {
        db.getMongo().advanceClusterTime(123);
    });

    assert.throws(function() {
        db.getMongo().advanceClusterTime('abc');
    });

    db.getMongo().advanceClusterTime({'clusterTime': 123});

    assert.eq({'clusterTime': 123}, db.getMongo().getClusterTime());

    db.getMongo().advanceClusterTime({'clusterTime': 100});

    assert.eq({'clusterTime': 123}, db.getMongo().getClusterTime());

    db.getMongo().advanceClusterTime({'clusterTime': 456});

    assert.eq({'clusterTime': 456}, db.getMongo().getClusterTime());
})();