diff options
author | Charlie Swanson <charlie.swanson@mongodb.com> | 2023-02-16 19:25:28 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2023-02-16 20:14:28 +0000 |
commit | b52f0ba969808bb44970a028e10b4106d203438a (patch) | |
tree | 7c52bfdd5348ce5ff9ab67f6a2d3c326a1a27413 /jstests | |
parent | c73aa5a010d6125417339e4de3de984518e4cdb4 (diff) | |
download | mongo-b52f0ba969808bb44970a028e10b4106d203438a.tar.gz |
SERVER-73735 Fail configuration more gracefully if telemetry is disabled
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/noPassthroughWithMongod/telemetry_configuration.js | 32 |
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); +} +}()); |