Skip to content

Use actual event class as much as possible

Lin Jen-Shin requested to merge 968-use-actual-event-class into master

What does this MR do and why?

Use actual event class as much as possible

I think there's very little reasons to use instance_double, because it's faking everything for no good reasons. It might be faster for heavy computing classes, but our Event class is fairly fast and even using the actual class, we can still stub methods.

Ideally if we have 100% test coverage, using instance_double might not be an issue, but that's not something we can fully guarantee and it's hiding us from testing actual implementation. Coupling here is fine and wanted because I think if the implementation is wrong we need to know.

This can help us catch bugs like #1376 (closed) where noteable_path is completely stubbed and we didn't realize that it's raising NotImplementedError.

This merge request did not remove stub for noteable_path because some tests are still relying on that. It can be done next after fixing other tests relying on that, or stub in tests that need it.

Expected impact & dry-runs

These are strongly recommended to assist reviewers and reduce the time to merge your change.

See https://gitlab.com/gitlab-org/quality/triage-ops/-/tree/master/doc/scheduled#testing-policies-with-a-dry-run on how to perform dry-runs for new policies.

See https://gitlab.com/gitlab-org/quality/triage-ops/-/blob/master/doc/reactive/best_practices.md#use-the-sandbox-to-test-new-processors on how to make sure a new processor can be tested.

Action items

See #968

Merge request reports