diff options
author | Will Buerger <will.buerger@mongodb.com> | 2023-05-17 11:49:47 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2023-05-17 12:58:52 +0000 |
commit | ae65ecae5514adc99d60b7396137a1acf2b44335 (patch) | |
tree | 24169f9a640321bfbbec649e869fe51b273b35e3 /jstests/noPassthrough/queryStats/query_stats_feature_flag.js | |
parent | 1b4a551a6b8c85611e26857217ce1a1e1363e716 (diff) | |
download | mongo-ae65ecae5514adc99d60b7396137a1acf2b44335.tar.gz |
SERVER-76427 Rename $telemetry to $queryStats
Diffstat (limited to 'jstests/noPassthrough/queryStats/query_stats_feature_flag.js')
-rw-r--r-- | jstests/noPassthrough/queryStats/query_stats_feature_flag.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/jstests/noPassthrough/queryStats/query_stats_feature_flag.js b/jstests/noPassthrough/queryStats/query_stats_feature_flag.js new file mode 100644 index 00000000000..bcce489d8da --- /dev/null +++ b/jstests/noPassthrough/queryStats/query_stats_feature_flag.js @@ -0,0 +1,34 @@ +/** + * Test that calls to read from telemetry store fail when feature flag is turned off. + */ +load('jstests/libs/analyze_plan.js'); +load("jstests/libs/feature_flag_util.js"); + +(function() { +"use strict"; + +// This test specifically tests error handling when the feature flag is not on. +// TODO SERVER-65800 this test can be removed when the feature flag is removed. +const conn = MongoRunner.runMongod(); +const testDB = conn.getDB('test'); +if (FeatureFlagUtil.isEnabled(testDB, "QueryStats")) { + jsTestLog("Skipping test since query stats are enabled."); + MongoRunner.stopMongod(conn); + return; +} + +// Pipeline to read telemetry store should fail without feature flag turned on. +assert.commandFailedWithCode( + testDB.adminCommand({aggregate: 1, pipeline: [{$queryStats: {}}], cursor: {}}), + ErrorCodes.QueryFeatureNotAllowed); + +// Pipeline, with a filter, to read telemetry store fails without feature flag turned on. +assert.commandFailedWithCode(testDB.adminCommand({ + aggregate: 1, + pipeline: [{$queryStats: {}}, {$match: {"key.queryShape.find": {$eq: "###"}}}], + cursor: {} +}), + ErrorCodes.QueryFeatureNotAllowed); + +MongoRunner.stopMongod(conn); +}()); |