Fix multiple issue creation for Generic Alerts
What does this MR do?
In !29941 (merged) we've extended IncidentManagement::ProcessAlertWorker
to link the created issue to the created alert.
The code assumed that IncidentManagement::CreateIssueService
returned the issue instance but it returns a Hash
. Sadly, this was not caught by the specs because they used an instance_double
which also returned the issue directly rather than the Hash
.
On GitLab.com this bug resulted a sidekiq job error undefined method 'persisted?' for #<Hash:0x00007f0bc5c901d0>
(see #220088 (comment 353968201)), so the job got retried which created multiple issues with the same alert payload without linking the alert to the created issue.
This MR fixes the bug and removes the instance_double
to make the specs a little more robust.
Attempts to fix #220088 (closed).
Screenshots
Only a single issue (Fixed issue
) is created and the Alert is linked properly (see View Issue
and Issue Iid
) to the created issue.
Issue list | Alerts details |
---|---|
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry - [-] 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
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
- [-] Label as security and @ mention
@gitlab-com/gl-security/appsec
- [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
- [-] Security reports checked/validated by a reviewer from the AppSec team