blob: 674760ebde2ed092b8b33cd447d15ee6b0dc00c2 (
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
|
/**
* Test that attempting to call getParameter on the featureCompatibilityVersion before the fCV is
* initialized does not crash the server (see SERVER-34600).
*
* This tests behavior dependent on a specific FCV.
* @tags: [multiversion_incompatible]
*/
(function() {
'use strict';
let rst = new ReplSetTest({nodes: 2});
rst.startSet();
let node = rst.nodes[0];
// The featureCompatibilityVersion parameter is initialized during rst.initiate(), so calling
// getParameter on the fCV before then will attempt to access an uninitialized fCV.
const getParamCmd = {
getParameter: 1,
featureCompatibilityVersion: 1
};
assert.commandFailedWithCode(
node.getDB('admin').runCommand(getParamCmd),
ErrorCodes.UnknownFeatureCompatibilityVersion,
'expected ' + tojson(getParamCmd) + ' to fail with code UnknownFeatureCompatibilityVersion');
rst.initiate();
// After the replica set is initialized, getParameter should successfully return the fCV.
const primary = rst.getPrimary();
const res = primary.adminCommand(getParamCmd);
assert.commandWorked(res);
assert.eq(res.featureCompatibilityVersion.version, latestFCV, tojson(res));
rst.stopSet();
})();
|