|
4 | 4 | from sentry.issues.issue_occurrence import IssueOccurrence |
5 | 5 | from sentry.issues.status_change_consumer import update_status |
6 | 6 | from sentry.issues.status_change_message import StatusChangeMessage |
7 | | -from sentry.models.group import Group |
| 7 | +from sentry.models.group import Group, GroupStatus |
8 | 8 | from sentry.notifications.models.notificationaction import ActionTarget |
9 | 9 | from sentry.services import eventstore |
10 | 10 | from sentry.tasks.post_process import post_process_group |
11 | 11 | from sentry.types.activity import ActivityType |
| 12 | +from sentry.types.group import GroupSubStatus |
12 | 13 | from sentry.workflow_engine.models import Detector |
13 | 14 | from sentry.workflow_engine.models.data_condition import Condition |
14 | 15 | from sentry.workflow_engine.types import DetectorPriorityLevel |
@@ -202,6 +203,9 @@ def test_resolution_from_critical(self, mock_trigger: MagicMock) -> None: |
202 | 203 | evaluation_result = self.process_packet_and_return_result(data_packet) |
203 | 204 | assert isinstance(evaluation_result, StatusChangeMessage) |
204 | 205 | message = evaluation_result.to_dict() |
| 206 | + # Packet processing already resolved the group; reset it so update_status creates a |
| 207 | + # genuine SET_RESOLVED activity, which is what dispatches workflow processing. |
| 208 | + group.update(status=GroupStatus.UNRESOLVED, substatus=GroupSubStatus.ONGOING) |
205 | 209 | # TODO: Actions don't trigger on resolution yet. Update this test when this functionality exists. |
206 | 210 | with patch("sentry.workflow_engine.tasks.workflows.metrics.incr") as mock_incr: |
207 | 211 | with self.tasks(): |
@@ -233,6 +237,9 @@ def test_resolution_from_warning(self, mock_trigger: MagicMock) -> None: |
233 | 237 | evaluation_result = self.process_packet_and_return_result(data_packet) |
234 | 238 | assert isinstance(evaluation_result, StatusChangeMessage) |
235 | 239 | message = evaluation_result.to_dict() |
| 240 | + # Packet processing already resolved the group; reset it so update_status creates a |
| 241 | + # genuine SET_RESOLVED activity, which is what dispatches workflow processing. |
| 242 | + group.update(status=GroupStatus.UNRESOLVED, substatus=GroupSubStatus.ONGOING) |
236 | 243 | # TODO: Actions don't trigger on resolution yet. Update this test when this functionality exists. |
237 | 244 | with patch("sentry.workflow_engine.tasks.workflows.metrics.incr") as mock_incr: |
238 | 245 | with self.tasks(): |
|
0 commit comments