summaryrefslogtreecommitdiff
path: root/jstests/noPassthroughWithMongod/telemetry_configuration.js
blob: 8d0b6ed68b50123b816f2566cb41cd0973b4ac02 (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
/**
 * Tests that the telemetry store can be resized if it is configured, and cannot be resized if it is
 * disabled.
 */
(function() {
"use strict";

load("jstests/libs/feature_flag_util.js");

if (FeatureFlagUtil.isEnabled(db, "Telemetry")) {
    // The feature flag is enabled - make sure the telemetry store can be configured.
    const original = assert.commandWorked(
        db.adminCommand({getParameter: 1, internalQueryConfigureTelemetryCacheSize: 1}));
    assert(original.hasOwnProperty("internalQueryConfigureTelemetryCacheSize"), original);
    const originalValue = original.internalQueryConfigureTelemetryCacheSize;
    try {
        assert.doesNotThrow(
            () => db.adminCommand(
                {setParameter: 1, internalQueryConfigureTelemetryCacheSize: '2MB'}));
        // Other tests verify that resizing actually affects the data structure size.
    } finally {
        assert.doesNotThrow(
            () => db.adminCommand(
                {setParameter: 1, internalQueryConfigureTelemetryCacheSize: originalValue}));
    }
} else {
    // The feature flag is disabled - make sure the telemetry store *cannot* be configured.
    assert.commandFailedWithCode(
        db.adminCommand({setParameter: 1, internalQueryConfigureTelemetryCacheSize: '2MB'}),
        7373500);
}
}());