-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Catalog and Routing
-
🟥 DDL, 🟦 Shard Catalog, 🟩 Routing and Topology
-
None
-
None
-
None
-
None
-
None
-
None
Several JS test libraries currently duplicate an inline check to detect whether the current test is running in a multiversion suite. The canonical form lives inside jsTestOptions() in the mongo shell, where it is used only locally to gate OTEL tracing:
const isMultiversion =
TestData.useRandomBinVersionsWithinReplicaSet || TestData.mixedBinVersions || TestData.mongosBinVersion;
The same idea is re-implemented (with slightly different flag sets) across several libraries:
- ReplSetTest dbHash comparison — checks useRandomBinVersionsWithinReplicaSet, mongosBinVersion, multiversionBinVersion, mixedBinVersions
- catalog list operations consistency validator — checks useRandomBinVersionsWithinReplicaSet, multiversionBinVersion
- raw operation utils — same flags as above
- shard transition util — only checks useRandomBinVersionsWithinReplicaSet
The closest thing to a reusable helper today is the private _clusterVersionInfo() method on ShardingTest, which returns {{
{isMixedVersion, oldestBinVersion}}} but is not exposed outside the class.
Proposal
Add a single exported helper (e.g. isMultiversionSuite()) in a shared lib such as jstests/libs/ — or expose the existing computation from the mongo shell — and replace the inline checks in the files listed above. This would:
- Give tests one canonical way to detect multiversion execution.
- Eliminate the inconsistency where some callers include multiversionBinVersion / mongosBinVersion and others do not.
- Make future additions to the set of multiversion flags a single-site change.