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

Add assert.throwsCode shell helper for testing

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.1.0-rc0
    • Component/s: None
    • Backwards Compatibility:
      Fully Compatible
    • Sprint:
      Query Execution 2021-05-31, Query Execution 2021-06-14, Query Execution 2021-06-28

      Description

      We have a helperĀ assert.throws() which returns the error which was thrown. A common pattern looks like this:

      let err = assert.throws(() => coll.aggregate(...));
      assert.eq(err.code, expectedCode);
      

      We should add a helper to the assertion library to condense this and simplify some of our tests. It will be a good counterpart to assert.commandFailedWithCode.

        Attachments

          Activity

            People

            Assignee:
            sebastien.mendez Sebastien Mendez
            Reporter:
            charlie.swanson Charlie Swanson
            Participants:
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: