You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cassandra, scylladb and dgraph test helpers call ctrl.Finish() early, so missing mock calls are never reported #4315
The deferred Finish runs when the helper returns, before any test has registered its expectations. gomock.NewController(t) also registers a Finish through t.Cleanup, but in go.uber.org/mock v0.6.0 that one short-circuits because the controller is already marked finished (gomock/controller.go:268-273). So "missing call(s)" is never reported for any test that uses these helpers.
In practice every .Times(1) in those packages only catches a wrong call, never a call that didn't happen. During the #4270 review, replacing cassandra's HealthCheck body so it skipped the probe query entirely still passed the test until require.True(t, ctrl.Satisfied()) was added.
Expected behavior
Drop the defer ctrl.Finish() from the three helpers and let the t.Cleanup registered by gomock.NewController(t) do the check at the end of the test. Some existing tests will probably start failing on expectations that were never met, and those should be fixed or removed rather than loosened.
Activity