Ejemplo n.º 1
0
 def test_add_mergeable(self):
     """Alert Merger - Merge Group - Add Alert to Group"""
     alert = Alert('', {'key': True},
                   set(),
                   merge_by_keys=['key'],
                   merge_window=timedelta(minutes=5))
     group = main.AlertMergeGroup(alert)
     assert_true(group.add(alert))  # An alert can always merge with itself
     assert_equal([alert, alert], group.alerts)
Ejemplo n.º 2
0
 def test_add_not_mergeable(self):
     """Alert Merger - Merge Group - Did Not Add Alert to Group"""
     alert1 = Alert('', {'key': True},
                    set(),
                    merge_by_keys=['key'],
                    merge_window=timedelta(minutes=5))
     alert2 = Alert('', {'key': True},
                    set(),
                    merge_by_keys=['other'],
                    merge_window=timedelta(minutes=5))
     group = main.AlertMergeGroup(alert1)
     assert_false(group.add(alert2))
     assert_equal([alert1], group.alerts)