Inappropriate uses of assert.NoError?
While completing a simple PR as part of the KubeCon contribfest I hit an issue where one test was causing a panic.
I tracked this down to the use of assert.NoError(t, err) for checking errors, but instead of being used as a guard for the subsequent test code it continued as if the error did not occur and dereferenced a nil. It looks as if this may occur often within the project tests.
Just wanna share the experience in cilium/cilium. I think the value of assert.NoError is to gather all the outputs/failures at once, so that developer can fix in one shot. However, it requires a careful thinking to make sure there is no side effect or misleading or even panic, hence in cilium/cilium most of assert.* is changed to require.* recently in main branch.
Yap, agreed: we should change those into require.NoError.
It was fixed by https://github.com/cilium/tetragon/pull/3769.