summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/cluster-server-parameter-op-observer.js
blob: ce8f7dbcb115a245ddcfaba6e0ebaaa3b5358237 (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
// Test that ClusterServerParameterOpObserver fires appropriately.
// @tags: [requires_replication]

(function() {
'use strict';

const kUnknownCSPLogId = 6226300;
const kUnknownCSPLogComponent = 'control';
const kUnknownCSPLogLevel = 3;

function runTest(conn) {
    const config = conn.getDB('config');
    const originalLogLevel =
        assert.commandWorked(config.setLogLevel(kUnknownCSPLogLevel, kUnknownCSPLogComponent))
            .was.verbosity;
    assert.writeOK(
        config.clusterParameters.insert({_id: 'foo', clusterParameterTime: Date(), value: 123}));
    assert.commandWorked(config.setLogLevel(originalLogLevel, kUnknownCSPLogComponent));
    assert(checkLog.checkContainsOnceJson(conn, kUnknownCSPLogId, {name: 'foo'}));
}

const rst = new ReplSetTest({nodes: 2});
rst.startSet();
rst.initiate();
runTest(rst.getPrimary());
rst.stopSet();
})();