-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: Testing
-
None
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:
- 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.
- 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.