import "jstests/multiVersion/libs/multi_rs.js"; import {ReplSetTest} from "jstests/libs/replsettest.js"; function fetchShardIdentityDoc(conn) { return conn.getDB("admin").system.version.findOne({_id: "shardIdentity"}); } (function () { jsTest.log("Test auto-bootstrap doesn't happen for replSet in old fcv"); let nodeOption = {binVersion: "last-lts"}; // Need at least 2 nodes because upgradeSet method needs to be able call step down // with another primary eligible node available. let replSet = new ReplSetTest({nodes: [nodeOption, nodeOption]}); replSet.startSet(); replSet.initiate(null, null, {initiateWithDefaultElectionTimeout: true}); replSet.upgradeSet({binVersion: "latest", setParameter: {featureFlagAllMongodsAreSharded: true}}); let primary = replSet.getPrimary(); assert.eq(null, fetchShardIdentityDoc(primary)); assert.commandWorked(primary.adminCommand({transitionToShardedCluster: 1, writeConcern: {w: "majority"}})); assert.neq(null, fetchShardIdentityDoc(primary)); assert.neq(null, primary.getDB("config").shards.findOne()); replSet.stopSet(); })();