summaryrefslogtreecommitdiff
path: root/jstests/noPassthroughWithMongod/telemetry_configuration.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/noPassthroughWithMongod/telemetry_configuration.js')
-rw-r--r--jstests/noPassthroughWithMongod/telemetry_configuration.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/jstests/noPassthroughWithMongod/telemetry_configuration.js b/jstests/noPassthroughWithMongod/telemetry_configuration.js
new file mode 100644
index 00000000000..8d0b6ed68b5
--- /dev/null
+++ b/jstests/noPassthroughWithMongod/telemetry_configuration.js
@@ -0,0 +1,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);
+}
+}());