5
5
6
6
class TestBackfillMetricAlertResolutionActionFilters (TestMigrations ):
7
7
app = "workflow_engine"
8
- migrate_from = "0059_fix_high_priority_condition_triggers "
9
- migrate_to = "0060_backfill_metric_alert_resolution_action_filters "
8
+ migrate_from = "0060_rename_azure_devops_action_to_vsts "
9
+ migrate_to = "0061_backfill_metric_alert_resolution_action_filters "
10
10
11
11
def mock_aci_objects (self ) -> tuple [DataConditionGroup , DataConditionGroup ]:
12
12
alert_rule = self .create_alert_rule (organization = self .organization )
13
13
workflow = self .create_workflow (organization = self .organization )
14
- self .create_alert_rule_workflow (alert_rule = alert_rule , workflow = workflow )
14
+ self .create_alert_rule_workflow (alert_rule_id = alert_rule . id , workflow = workflow )
15
15
16
16
critical_dcg = self .create_data_condition_group (organization = self .organization )
17
17
self .create_workflow_data_condition_group (workflow = workflow , condition_group = critical_dcg )
@@ -33,9 +33,11 @@ def mock_aci_objects(self) -> tuple[DataConditionGroup, DataConditionGroup]:
33
33
34
34
return critical_dcg , warning_dcg
35
35
36
- def create_resolve_action_filter (self , dcg : DataConditionGroup ) -> None :
36
+ def create_resolve_action_filter (
37
+ self , dcg : DataConditionGroup , comparison : DetectorPriorityLevel
38
+ ) -> None :
37
39
self .create_data_condition (
38
- comparison = DetectorPriorityLevel . HIGH ,
40
+ comparison = comparison ,
39
41
condition_result = True ,
40
42
type = Condition .ISSUE_PRIORITY_DEESCALATING ,
41
43
condition_group = dcg ,
@@ -56,12 +58,12 @@ def setup_initial_state(self):
56
58
57
59
# both dcgs have a resolution action filter
58
60
self .critical_dcg_2 , self .warning_dcg_2 = self .mock_aci_objects ()
59
- self .create_resolve_action_filter (self .critical_dcg_2 )
60
- self .create_resolve_action_filter (self .warning_dcg_2 )
61
+ self .create_resolve_action_filter (self .critical_dcg_2 , DetectorPriorityLevel . HIGH )
62
+ self .create_resolve_action_filter (self .warning_dcg_2 , DetectorPriorityLevel . MEDIUM )
61
63
62
64
# only one dcg has a resolution action filter
63
65
self .critical_dcg_3 , self .warning_dcg_3 = self .mock_aci_objects ()
64
- self .create_resolve_action_filter (self .warning_dcg_3 )
66
+ self .create_resolve_action_filter (self .warning_dcg_3 , DetectorPriorityLevel . MEDIUM )
65
67
66
68
def test_simple (self ):
67
69
self .assert_resolve_action_filter_exists (self .critical_dcg_1 , DetectorPriorityLevel .HIGH )
0 commit comments