Skip to content

ResourceEventsTestSuite: Rework to be more in-line with newer tests #344

Description

@YYDan

Description

ResourceEventsTestSuite was never covered by the summer 2024 refactor campaign. It is 544 lines reporting only 3 results:

Fact Asserts Lines
event_perform_object_test 3 238
event_perform_test 2 229
event_user_test 1 75

The low assert count relative to the line count is itself the problem: these facts perform a long sequence of event dispatches and then assert once or twice at the end over accumulated state. So as well as splitting, this suite needs additional asserts so that each individual event dispatch is verified rather than only the aggregate outcome.

Target: one fact per event type dispatched, with an assert per dispatch — likely 40+ facts. The exact number should be settled by the audit in step 1.

This is the most open-ended of the remaining refactors, because it is as much a coverage improvement as a split. It may be worth doing after the more mechanical suites.

Script Name

ResourceEventsTestSuite

Steps To The Task

  • Audit all three facts and enumerate every event dispatched, and what is currently verified about each
  • Propose a target fact list in the issue before starting, since this involves adding coverage rather than only redistributing it
  • Split into one fact per event type, named <original_name> #N
  • Add an assert per dispatch so each event is individually verified, not just the accumulated end state
  • Give each new fact its own object creation and cleanup so it is self-contained
  • Add section comment headers per event family
  • Run the suite on VM and YYC and confirm the previously covered behaviour still passes

Metadata

Metadata

Assignees

Labels

refactorAn improvement to existing test/module code

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions