Refactor alert processing specs for uniformity
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
-
📋 Does this MR need a changelog?-
I have included a changelog entry. -
I have not included a changelog entry *because there are no functional changes in this MR.
-
- [-] Documentation (if required)
-
Code review guidelines -
Merge request performance guidelines -
Style guides - [-] Database guides
-
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. - [-] Tested in all supported browsers
- [-] Informed Infrastructure department of a default or new setting change, if applicable per definition of done