forked from mongodb/mongo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmixed_version_replica_set.js
35 lines (33 loc) · 1.48 KB
/
mixed_version_replica_set.js
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
/**
* Tests initializing a mixed version replica set through resmoke.
*
* @tags: [
* # The test runs commands that are not allowed with security token: replSetGetStatus.
* not_allowed_with_signed_security_token,
* multiversion_sanity_check
* ]
*/
const latestBinVersion = MongoRunner.getBinVersionFor("latest");
if (testingReplication && TestData && TestData.mixedBinVersions) {
const replSetStatus = db.adminCommand({"replSetGetStatus": 1});
const members = replSetStatus["members"];
assert.eq(TestData.mixedBinVersions.length, replSetStatus["members"].length);
for (let i = 0; i < TestData.mixedBinVersions.length; i++) {
const conn = new Mongo(members[i]["name"]);
const admin = conn.getDB("admin");
const serverStatus = admin.serverStatus();
const actualVersion = serverStatus["version"];
const expectedVersion = TestData.mixedBinVersions[i] === "new"
? latestBinVersion
: MongoRunner.getBinVersionFor(TestData.multiversionBinVersion);
print(actualVersion,
expectedVersion,
MongoRunner.getBinVersionFor(TestData.multiversionBinVersion));
print(TestData.multiversionBinVersion);
assert(MongoRunner.areBinVersionsTheSame(actualVersion, expectedVersion));
}
} else {
jsTestLog(
"This tests initializing a mixed version replica set through resmoke. Skipping test run" +
" because testingReplication and TestData.mixedBinVersion are not set.");
}