blob: 919d9f87bafc9ea5157623c983a640381cb0075c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
/**
* Test that telemetry doesn't work on a lower FCV version but works after an FCV upgrade.
* @tags: [featureFlagQueryStats]
*/
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, "QueryStats"));
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: [{$queryStats: {}}], 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: [{$queryStats: {}}], cursor: {}}),
);
}
testLower(true);
testLower(false);
MongoRunner.stopMongod(conn);
})();
|