blob: 0ae4e8408c34ce19b65d48bde4ed176c463375c3 (
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
|
/**
* 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")) {
function testTelemetrySetting(paramName, paramValue) {
// The feature flag is enabled - make sure the telemetry store can be configured.
const original = assert.commandWorked(db.adminCommand({getParameter: 1, [paramName]: 1}));
assert(original.hasOwnProperty(paramName), original);
const originalValue = original[paramName];
try {
assert.doesNotThrow(() => db.adminCommand({setParameter: 1, [paramName]: paramValue}));
// Other tests verify that changing the parameter actually affects the behavior.
} finally {
assert.doesNotThrow(() =>
db.adminCommand({setParameter: 1, [paramName]: originalValue}));
}
}
testTelemetrySetting("internalQueryConfigureTelemetryCacheSize", "2MB");
testTelemetrySetting("internalQueryConfigureTelemetrySamplingRate", 2147483647);
} else {
// The feature flag is disabled - make sure the telemetry store *cannot* be configured.
assert.commandFailedWithCode(
db.adminCommand({setParameter: 1, internalQueryConfigureTelemetryCacheSize: '2MB'}),
7373500);
assert.commandFailedWithCode(
db.adminCommand({setParameter: 1, internalQueryConfigureTelemetrySamplingRate: 2147483647}),
7506200);
}
}());
|