Repository navigation
test: Correct the cause recorded for the acknowledged-alert test and drop the redundant action #2316
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
test: Correct the cause recorded for the acknowledged-alert test and drop the redundant action #2316
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1523,19 +1523,11 @@ class MonitorRunnerServiceIT : AlertingRestTestCase() { | |
| params.docCount > 0 | ||
| """.trimIndent() | ||
|
|
||
| // The assertions below require lastNotificationTime to advance for a completed alert, and | ||
| // BucketLevelMonitorRunner only advances it for alerts a PER_ALERT action ran for: alertsToUpdate is | ||
| // populated inside the per-alert action loop. Rewriting the PER_ALERT policies is therefore not enough, | ||
| // because every generated action may independently be PER_EXECUTION, leaving nothing to advance the | ||
| // timestamp. Prepend one PER_ALERT action carrying COMPLETED, and keep the generated ones for their | ||
| // randomness. | ||
| val actions = listOf( | ||
| randomActionWithPolicy( | ||
| actionExecutionPolicy = ActionExecutionPolicy( | ||
| PerAlertActionScope(setOf(AlertCategory.NEW, AlertCategory.DEDUPED, AlertCategory.COMPLETED)) | ||
| ) | ||
| ) | ||
| ) + randomActionsForBucketLevelTrigger(min = 1).map { | ||
| // The rewrite below has to leave a non-empty list. randomBucketLevelTrigger replaces an empty | ||
| // actions list with freshly generated ones, and those never pass through this rewrite, so a | ||
| // PER_ALERT policy without COMPLETED can reach the trigger and leave the completed alert's | ||
| // lastNotificationTime untouched. | ||
| val actions = randomActionsForBucketLevelTrigger(min = 1).map { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: The non-empty guarantee the comment above depends on lives in the helper's |
||
| if (it.actionExecutionPolicy?.actionExecutionScope is PerAlertActionScope) { | ||
| it.copy( | ||
| actionExecutionPolicy = ActionExecutionPolicy( | ||
|
|
||
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.
nit: Regenerated actions can also lack
DEDUPED(e.g.PerAlertActionScope{NEW}), and then the test fails earlier, at "Active alert was not updated", rather than at the completed-alert check. Maybe: "...so a PER_ALERT policy missing DEDUPED or COMPLETED can reach the trigger and leave lastNotificationTime untouched."