-
-
Notifications
You must be signed in to change notification settings - Fork 578
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to test notification publisher #3983
Conversation
Signed-off-by: Ross Murphy <[email protected]>
Signed-off-by: Ross Murphy <[email protected]>
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferencesCodacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this addresses the original feature request.
Having a test button for the email publisher makes sense, because DT only ever connects to a single email server, and those connection details are a global setting.
However, for pretty much all other publishers, there is no global configuration. Instead, destination URLs are configured for each alert (see for example MS Teams, Slack, Webhook). Testing the publisher without an alert (NotificationRule
) will not work for those.
We'd need a test functionality on the alert / NotificationRule
level. This also means we can't use the same hardcoded Notification
, since alerts are configured for specific levels and groups. Either we dynamically build a Notification
object that will satisfy the alert under test, or we let users provide an entirely custom one.
The approach I went for was to test only the destination for the selected alert rule in the setup page, which worked for the publishers I tested (Slack, MS Teams). If we want to test on the Could possibly POST the |
That approach is not necessarily wrong, either. But it limits the usefulness of the check a bit, since individual rules can be customized further (i.e. auth headers for Outbound Webhook alerts). Ideally you'd want to know whether a specific rule works.
I think if we can assemble one or more notifications (i.e. one for each enabled |
Signed-off-by: Ross Murphy <[email protected]>
Signed-off-by: Ross Murphy <[email protected]>
Signed-off-by: Ross Murphy <[email protected]>
@nscuro I opted for adding Any feedback/ideas on this implementation? |
We could alternatively assemble "correct" dummy subjects depending on the group, similar to how we do it in This would avoid the errors you were seeing, and also help with testing custom notification templates. |
Signed-off-by: Ross Murphy <[email protected]>
Looks great @2000rosser! Do you think you can increase the test coverage a bit? |
@nscuro Thanks! Yeah np |
Signed-off-by: Ross Murphy <[email protected]>
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferencesCodacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Description
Add a new endpoint that can be used to send out a notification test for the specified rule using its UUID.
Front end implementation: DependencyTrack/frontend#949
Addressed Issue
#2924
Checklist