summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/telemetry/telemetry_feature_flag.js
diff options
context:
space:
mode:
authorliubov.molchanova <liubov.molchanova@mongodb.com>2023-05-17 08:16:48 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-05-17 10:20:42 +0000
commit87160f876c6fb94f5d03062b2caee57539ec5d8e (patch)
treeb78d9ca9e853a236e0a2f6432a6ac02dc50119cd /jstests/noPassthrough/telemetry/telemetry_feature_flag.js
parent1c390a0c50104a04cbd8ecbefb99eaf22e1bc914 (diff)
downloadmongo-87160f876c6fb94f5d03062b2caee57539ec5d8e.tar.gz
Revert "SERVER-76427: Rename $telemetry to $queryStats"
This reverts commit d646e44b7801a3e5b3230bbae7dcfe05a5ed8707.
Diffstat (limited to 'jstests/noPassthrough/telemetry/telemetry_feature_flag.js')
-rw-r--r--jstests/noPassthrough/telemetry/telemetry_feature_flag.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/jstests/noPassthrough/telemetry/telemetry_feature_flag.js b/jstests/noPassthrough/telemetry/telemetry_feature_flag.js
new file mode 100644
index 00000000000..4071b732796
--- /dev/null
+++ b/jstests/noPassthrough/telemetry/telemetry_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, "Telemetry")) {
+ jsTestLog("Skipping test since telemetry is enabled.");
+ MongoRunner.stopMongod(conn);
+ return;
+}
+
+// Pipeline to read telemetry store should fail without feature flag turned on.
+assert.commandFailedWithCode(
+ testDB.adminCommand({aggregate: 1, pipeline: [{$telemetry: {}}], cursor: {}}),
+ ErrorCodes.QueryFeatureNotAllowed);
+
+// Pipeline, with a filter, to read telemetry store fails without feature flag turned on.
+assert.commandFailedWithCode(testDB.adminCommand({
+ aggregate: 1,
+ pipeline: [{$telemetry: {}}, {$match: {"key.queryShape.find": {$eq: "###"}}}],
+ cursor: {}
+}),
+ ErrorCodes.QueryFeatureNotAllowed);
+
+MongoRunner.stopMongod(conn);
+}());