|
@@ -129,6 +129,32 @@ class EventAttributeConditionTest(RuleTestCase):
|
|
|
)
|
|
|
self.assertDoesNotPass(rule, event)
|
|
|
|
|
|
+ def test_contains_message(self):
|
|
|
+ event = self.get_event()
|
|
|
+ rule = self.get_rule(
|
|
|
+ data={"match": MatchType.CONTAINS, "attribute": "message", "value": "hello"}
|
|
|
+ )
|
|
|
+ self.assertPasses(rule, event)
|
|
|
+
|
|
|
+ # Validate that this searches message in the same way that snuba does
|
|
|
+ event = self.get_event(message="")
|
|
|
+ # This should still pass, even though the message is now empty
|
|
|
+ rule = self.get_rule(
|
|
|
+ data={"match": MatchType.CONTAINS, "attribute": "message", "value": "hello"}
|
|
|
+ )
|
|
|
+ self.assertPasses(rule, event)
|
|
|
+
|
|
|
+ # The search should also include info from the exception if present
|
|
|
+ rule = self.get_rule(
|
|
|
+ data={"match": MatchType.CONTAINS, "attribute": "message", "value": "SyntaxError"}
|
|
|
+ )
|
|
|
+ self.assertPasses(rule, event)
|
|
|
+
|
|
|
+ rule = self.get_rule(
|
|
|
+ data={"match": MatchType.CONTAINS, "attribute": "message", "value": "not present"}
|
|
|
+ )
|
|
|
+ self.assertDoesNotPass(rule, event)
|
|
|
+
|
|
|
def test_does_not_contain(self):
|
|
|
event = self.get_event()
|
|
|
rule = self.get_rule(
|