summaryrefslogtreecommitdiff
path: root/jstests/multiVersion/genericSetFCVUsage/2_test_launching_cluster.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/multiVersion/genericSetFCVUsage/2_test_launching_cluster.js')
-rw-r--r--jstests/multiVersion/genericSetFCVUsage/2_test_launching_cluster.js103
1 files changed, 57 insertions, 46 deletions
diff --git a/jstests/multiVersion/genericSetFCVUsage/2_test_launching_cluster.js b/jstests/multiVersion/genericSetFCVUsage/2_test_launching_cluster.js
index 00e025e910d..69f228875cc 100644
--- a/jstests/multiVersion/genericSetFCVUsage/2_test_launching_cluster.js
+++ b/jstests/multiVersion/genericSetFCVUsage/2_test_launching_cluster.js
@@ -8,60 +8,71 @@ load('./jstests/multiVersion/libs/verify_versions.js');
(function() {
"use strict";
-function checkEquivalent(testConfig, st) {
- var expectedVersions = [testConfig.other.mongosOptions.binVersion];
- var expectedNodes = [...testConfig.shards.rs0.nodes, ...testConfig.shards.rs1.nodes];
- for (j = 0; j < expectedNodes.length; j++) {
- expectedVersions.push(expectedNodes[j].binVersion);
- }
-
- var versionsFound = [st.s0.getBinVersion()];
- var nodes = [...st._rs[0].test.nodes, ...st._rs[1].test.nodes];
- for (var j = 0; j < nodes.length; j++) {
- versionsFound.push(nodes[j].getBinVersion());
- }
- assert.allBinVersions(expectedVersions, versionsFound);
-}
-
-if (MongoRunner.areBinVersionsTheSame("last-continuous", "last-lts")) {
- jsTest.log("Skipping test because 'last-continuous' == 'last-lts'");
+// TODO(SERVER-61100): Re-enable this test.
+if (true) {
+ jsTestLog("Skipping test as it is currently disabled.");
return;
}
-const invalidMixedVersionsToCheck = [
- {
- shards: {
- rs0: {nodes: [{binVersion: "last-continuous"}, {binVersion: "last-lts"}]},
- rs1: {nodes: [{binVersion: "last-lts"}]}
- },
- other: {mongosOptions: {binVersion: "last-lts"}}
- },
+// Sharded cluster upgrade order: config servers -> shards -> mongos.
+const mixedVersionsToCheck = [
+ {config: ["latest"], shard: ["last-lts", "latest"], mongos: ["last-lts"]},
+ {config: ["latest"], shard: ["last-continuous", "latest"], mongos: ["last-continuous"]},
+ {config: ["latest"], shard: ["last-continuous", "last-lts"], mongos: ["last-continuous"]},
+ {config: ["latest"], shard: ["last-lts", "last-continuous"], mongos: ["last-lts"]},
];
-for (let config of invalidMixedVersionsToCheck) {
- jsTest.log("Testing invalid mixed versions: " + tojson(config));
+for (let versions of mixedVersionsToCheck) {
+ jsTest.log("Testing mixed versions: " + tojson(versions));
+ try {
+ // Set up a multi-version cluster
+ var st = new ShardingTest({
+ shards: 2,
+ mongos: 2,
+ other: {
+ mongosOptions: {binVersion: versions.mongos},
+ configOptions: {binVersion: versions.config},
+ shardOptions: {binVersion: versions.shard},
+ enableBalancer: true
+ }
+ });
+ } catch (e) {
+ if (e instanceof Error) {
+ if (e.message.includes(
+ "Can only specify one of 'last-lts' and 'last-continuous' in binVersion, not both.")) {
+ continue;
+ }
+ }
+ throw e;
+ }
+ if ((versions.shard[0] === "last-continuous" && versions.shard[1] === "last-lts") ||
+ (versions.shard[1] === "last-continuous" && versions.shard[0] === "last-lts")) {
+ assert(
+ MongoRunner.areBinVersionsTheSame("last-continuous", "last-lts"),
+ "Should have thrown error in creating ShardingTest because can only specify one of 'last-lts' and 'last-continuous' in binVersion, not both.");
+ }
+ var shards = [st.shard0, st.shard1];
+ var mongoses = [st.s0, st.s1];
+ var configs = [st.config0, st.config1, st.config2];
+
+ // Make sure we have hosts of all the different versions
+ var versionsFound = [];
+ for (var j = 0; j < shards.length; j++)
+ versionsFound.push(shards[j].getBinVersion());
- let err = assert.throws(
- () => new ShardingTest({shouldFailInit: true, shards: config.shards, other: config.other}));
- assert.eq(
- true,
- err.message.includes(
- "Can only specify one of 'last-lts' and 'last-continuous' in binVersion, not both."),
- "Unexpected Error");
-}
+ assert.allBinVersions(versions.shard, versionsFound);
-const validMixedVersionsToCheck = [
- {
- shards: {rs0: {nodes: [{binVersion: "latest"}]}, rs1: {nodes: [{binVersion: "last-lts"}]}},
- other: {mongosOptions: {binVersion: "last-lts"}}
- },
-];
+ versionsFound = [];
+ for (var j = 0; j < mongoses.length; j++)
+ versionsFound.push(mongoses[j].getBinVersion());
-for (let config of validMixedVersionsToCheck) {
- jsTest.log("Testing valid mixed versions: " + tojson(config));
- var st = new ShardingTest({shards: config.shards, other: config.other});
- var configs = [st.config0, st.config1, st.config2];
- checkEquivalent(config, st);
+ assert.allBinVersions(versions.mongos, versionsFound);
+
+ versionsFound = [];
+ for (var j = 0; j < configs.length; j++)
+ versionsFound.push(configs[j].getBinVersion());
+
+ assert.allBinVersions(versions.config, versionsFound);
st.stop();
}