Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-57157

assert serverStatus command works in getBinVersion() jstest helper

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.2.15, 4.4.7, 4.0.26, 5.0.0-rc2, 5.1.0-rc0
    • Component/s: None
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Backport Requested:
      v5.0, v4.4, v4.2, v4.0
    • Sprint:
      Repl 2021-05-31, Repl 2021-06-14

      Description

      In the verify_versions.js helper file, we have a function getBinVersion() that will run the serverStatus command on the calling node and return the binary version field from the result object. However, if this command fails, the function will return null, as the result object won't contain a version field on failure. We should wrap the serverStatus in an assert.commandWorked() call so that we catch this failure before the function returns.

       

      The function returning null can have larger downstream impacts. For example, we sometimes pass the result of getBinVersion() to another jstest helper getBinVersionFor(). Here is an example. In the getBinVersionFor() implementation, if null is passed in as the version, we automatically default the version to latest. 

       

      The following scenario can occur: if we have two nodes, one in last-lts and one in latest, and we call getBinVersion() on the the last-lts and the serverStatus command fails, we will return null. If this null result is passed in to the getBinVersionFor() function, it will return the bin version of the node as latest. Thus, if we are checking for binary version equality using a function like areBinVersionsTheSame(), we will get true for the last-lts and latest node.

        Attachments

          Activity

            People

            Assignee:
            ali.mir Ali Mir
            Reporter:
            ali.mir Ali Mir
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: