diff options
author | liubov.molchanova <liubov.molchanova@mongodb.com> | 2023-05-17 08:16:48 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2023-05-17 10:20:42 +0000 |
commit | 87160f876c6fb94f5d03062b2caee57539ec5d8e (patch) | |
tree | b78d9ca9e853a236e0a2f6432a6ac02dc50119cd /jstests/noPassthrough/telemetry/telemetry_upgrade.js | |
parent | 1c390a0c50104a04cbd8ecbefb99eaf22e1bc914 (diff) | |
download | mongo-87160f876c6fb94f5d03062b2caee57539ec5d8e.tar.gz |
Revert "SERVER-76427: Rename $telemetry to $queryStats"
This reverts commit d646e44b7801a3e5b3230bbae7dcfe05a5ed8707.
Diffstat (limited to 'jstests/noPassthrough/telemetry/telemetry_upgrade.js')
-rw-r--r-- | jstests/noPassthrough/telemetry/telemetry_upgrade.js | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/jstests/noPassthrough/telemetry/telemetry_upgrade.js b/jstests/noPassthrough/telemetry/telemetry_upgrade.js new file mode 100644 index 00000000000..f396d23b948 --- /dev/null +++ b/jstests/noPassthrough/telemetry/telemetry_upgrade.js @@ -0,0 +1,43 @@ +/** + * Test that telemetry doesn't work on a lower FCV version but works after an FCV upgrade. + * @tags: [featureFlagTelemetry] + */ +load('jstests/libs/analyze_plan.js'); +load("jstests/libs/feature_flag_util.js"); + +(function() { +"use strict"; + +const dbpath = MongoRunner.dataPath + jsTestName(); +let conn = MongoRunner.runMongod({dbpath: dbpath}); +let testDB = conn.getDB(jsTestName()); +// This test should only be run with the flag enabled. +assert(FeatureFlagUtil.isEnabled(testDB, "Telemetry")); + +function testLower(restart = false) { + let adminDB = conn.getDB("admin"); + assert.commandWorked(adminDB.runCommand( + {setFeatureCompatibilityVersion: binVersionToFCV("last-lts"), confirm: true})); + if (restart) { + MongoRunner.stopMongod(conn); + conn = MongoRunner.runMongod({dbpath: dbpath, noCleanData: true}); + testDB = conn.getDB(jsTestName()); + adminDB = conn.getDB("admin"); + } + + assert.commandFailedWithCode( + testDB.adminCommand({aggregate: 1, pipeline: [{$telemetry: {}}], cursor: {}}), 6579000); + + // Upgrade FCV. + assert.commandWorked(adminDB.runCommand( + {setFeatureCompatibilityVersion: binVersionToFCV("latest"), confirm: true})); + + // We should be able to run a telemetry pipeline now that the FCV is correct. + assert.commandWorked( + testDB.adminCommand({aggregate: 1, pipeline: [{$telemetry: {}}], cursor: {}}), + ); +} +testLower(true); +testLower(false); +MongoRunner.stopMongod(conn); +})(); |