Expose a common helper for detecting multiversion suites in JS tests

    • 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:

      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:

      1. Give tests one canonical way to detect multiversion execution.
      2. Eliminate the inconsistency where some callers include multiversionBinVersion / mongosBinVersion and others do not.
      3. Make future additions to the set of multiversion flags a single-site change.

            Assignee:
            Unassigned
            Reporter:
            Tommaso Tocci
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: