Skip to content

Refactor alert processing specs for uniformity

Sarah Yasonik requested to merge sy-refactor-alert-processing-specs into master

What does this MR do?

Related issues: #299962 (closed), #299960 (closed)

This MR refactors the specs for services which process alerts, paving the way for !57302 (merged), which brings the alert processing behavior for prometheus and HTTP integrations even closer together.

Context

We have several services which share similar behavior, as they inherit or call upon a class which includes the AlertManagement::AlertProcessing module, including:

  • AlertManagement::ProcessPrometheusAlertService
  • Projects::Alerting::NotifyService
  • AlertManagement::NetworkAlertService
  • Projects::Prometheus::Alerts::NotifyService

The tests for these classes, however, have only a limited number of shared examples. This has led to some inconsistencies in the scenarios covered for each class's tests. In modifying some of the behavior for alert processing, I feel it made sense to better align the tests for these classes at the same time.

The main change I've made is to reorganize & supplement the existing shared examples for alert processing, breaking them up into files based on individual settings/feature. Then the shared examples can be grouped to compose the expected flow for a given scenario.

One of my goals was to more consistently include assertions that certain actions didn't happen. alert_firing_shared_examples.rb:105 shows the spirit of that idea well.

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Edited by Sarah Yasonik

Merge request reports