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

Change assertion functions to accept a function returning a string as the message parameter

    XMLWordPrintableJSON

Details

    • Fully Compatible
    • TIG 2018-02-26

    Description

      SERVER-32497 and SERVER-32778 are two recent cases where accidentally calling tojson() in a loop impacts performance negatively enough to cause tests to fail. We could avoid this issue by changing the assertion functions to accept a function returning a string as the message parameter and only lazily calling the function if doassert() would be called. Note: The doassert() functions attempts to handle when the message parameter is a function; however, it is defeated by the assertion functions prefixing a string to the intended assertion message.

      As part of this ticket, we should also update existing tests that define an object with a "toString" property as a way to define a function for getting the assertion message to just pass the function directly instead.

      Attachments

        Issue Links

          Activity

            People

              david.bradford@mongodb.com David Bradford (Inactive)
              max.hirschhorn@mongodb.com Max Hirschhorn
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: