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

assert serverStatus command works in getBinVersion() jstest helper

    • Fully Compatible
    • ALL
    • v5.0, v4.4, v4.2, v4.0
    • Repl 2021-05-31, Repl 2021-06-14

      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.

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

              Created:
              Updated:
              Resolved: