[GODRIVER-2870] Replace uses of "assert" for error checking where "require" is more correct Created: 12/Jun/23  Updated: 26/Jun/23

Status: Backlog
Project: Go Driver
Component/s: Testing
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Unknown
Reporter: Matt Dale Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

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.

Generated at Thu Feb 08 08:39:32 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.