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

Shell needs an "assert failed with code" function that works for any command response

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.7.1
    • Affects Version/s: None
    • Component/s: Testing Infrastructure
    • Labels:
    • Minor Change
    • TIG 2018-1-15, TIG 2018-1-29
    • 0

      I'm writing tests that use a variety of different commands and need to assert that they all fail with a particular code. However, the experience is extremely frustrating because the existing assert helpers all require a particular response format, and can't be used uniformly throughout:

      • Error responses with a code field are caught by assert.commandWorked()
      • Error responses with writeError are caught by assert.writeError()
      • I have no idea if anyone can handle the plural writeErrors generated when using the bulk API
      • Any other error response format I'm missing?

      I would be very happy if we had one magic function that just "did the right thing" based on the response type / format.

            kevin.albertson@mongodb.com Kevin Albertson
            kyle.suarez@mongodb.com Kyle Suarez
            0 Vote for this issue
            5 Start watching this issue