File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed
src/sentry/workflow_engine/processors
tests/sentry/workflow_engine/processors Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change 2
2
from collections import defaultdict
3
3
from datetime import datetime , timedelta
4
4
5
+ from django .db import models
5
6
from django .utils import timezone
6
7
7
8
from sentry import features
@@ -183,8 +184,11 @@ def filter_recently_fired_workflow_actions(
183
184
)
184
185
update_workflow_action_group_statuses (now , statuses_to_update , missing_statuses )
185
186
186
- # TODO: somehow attach workflows so we can fire actions with the appropriate workflow env
187
- return Action .objects .filter (id__in = list (action_to_workflow_ids .keys ()))
187
+ return Action .objects .filter (id__in = list (action_to_workflow_ids .keys ())).annotate (
188
+ workflow_id = models .F (
189
+ "dataconditiongroupaction__condition_group__workflowdataconditiongroup__workflow__id"
190
+ )
191
+ )
188
192
189
193
190
194
def get_available_action_integrations_for_org (organization : Organization ) -> list [RpcIntegration ]:
Original file line number Diff line number Diff line change @@ -56,6 +56,9 @@ def test(self):
56
56
set (DataConditionGroup .objects .all ()), self .event_data
57
57
)
58
58
assert set (triggered_actions ) == {self .action }
59
+ assert {getattr (action , "workflow_id" ) for action in triggered_actions } == {
60
+ self .workflow .id ,
61
+ }
59
62
60
63
for status in [status_1 , status_2 ]:
61
64
status .refresh_from_db ()
@@ -103,6 +106,10 @@ def test_multiple_workflows_single_action__first_fire(self):
103
106
)
104
107
# dedupes action if both workflows will fire it
105
108
assert set (triggered_actions ) == {self .action }
109
+ assert {getattr (action , "workflow_id" ) for action in triggered_actions } == {
110
+ self .workflow .id ,
111
+ workflow .id ,
112
+ }
106
113
107
114
assert WorkflowActionGroupStatus .objects .filter (action = self .action ).count () == 2
108
115
@@ -125,6 +132,10 @@ def test_multiple_workflows_single_action__later_fire(self):
125
132
)
126
133
# fires one action for the workflow that can fire it
127
134
assert set (triggered_actions ) == {self .action }
135
+ assert {getattr (action , "workflow_id" ) for action in triggered_actions } == {
136
+ self .workflow .id ,
137
+ workflow .id ,
138
+ }
128
139
129
140
assert WorkflowActionGroupStatus .objects .filter (action = self .action ).count () == 2
130
141
You can’t perform that action at this time.
0 commit comments