Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-2870

Replace uses of "assert" for error checking where "require" is more correct

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: Testing
    • Labels:

      There are about 1,000 instances where assert.Nil or assert.NoError are used in Go driver tests. The vast majority of those should probably be using require.NoError for 2 reasons:

      1. Using require makes the test stop immediately when an assertion failure is encountered. In the case of an unexpected error, subsequent assertions are likely irrelevant and only confuse whoever troubleshoots the test by printing extra failures instead of highlighting the unexpected error.
      2. Using NoError expresses the expected behavior more clearly in the code and in the assertion output.

      Definition of done:

      • Replace all uses of assert.Nil or assert.NoError with require.NoError if a returned error would make subsequent assertions meaningless.

            Unassigned Unassigned
            matt.dale@mongodb.com Matt Dale
            0 Vote for this issue
            1 Start watching this issue