|
@@ -472,6 +472,74 @@ class SnubaSearchTest(SnubaTestCase):
|
|
|
)
|
|
|
assert set(results) == set([])
|
|
|
|
|
|
+ def test_search_filter_query_with_custom_priority_tag(self):
|
|
|
+ priority = 'high'
|
|
|
+ self.store_event(
|
|
|
+ data={
|
|
|
+ 'fingerprint': ['put-me-in-group2'],
|
|
|
+ 'timestamp': (self.group2.first_seen + timedelta(days=1)).isoformat()[:19],
|
|
|
+ 'stacktrace': {
|
|
|
+ 'frames': [{
|
|
|
+ 'module': 'group2'
|
|
|
+ }]
|
|
|
+ },
|
|
|
+ 'message': 'group2',
|
|
|
+ 'tags': {
|
|
|
+ 'priority': priority,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ project_id=self.project.id,
|
|
|
+ )
|
|
|
+
|
|
|
+ results = self.make_query(
|
|
|
+ search_filter_query='priority:%s' % priority,
|
|
|
+ tags={'priority': priority},
|
|
|
+ )
|
|
|
+
|
|
|
+ assert set(results) == set([self.group2])
|
|
|
+
|
|
|
+ def test_search_filter_query_with_custom_priority_tag_and_priority_sort(self):
|
|
|
+ priority = 'high'
|
|
|
+ for i in range(1, 3):
|
|
|
+ self.store_event(
|
|
|
+ data={
|
|
|
+ 'fingerprint': ['put-me-in-group1'],
|
|
|
+ 'timestamp': (self.group2.last_seen + timedelta(days=i)).isoformat()[:19],
|
|
|
+ 'stacktrace': {
|
|
|
+ 'frames': [{
|
|
|
+ 'module': 'group1'
|
|
|
+ }]
|
|
|
+ },
|
|
|
+ 'message': 'group1',
|
|
|
+ 'tags': {
|
|
|
+ 'priority': priority,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ project_id=self.project.id,
|
|
|
+ )
|
|
|
+ self.store_event(
|
|
|
+ data={
|
|
|
+ 'fingerprint': ['put-me-in-group2'],
|
|
|
+ 'timestamp': (self.group2.last_seen + timedelta(days=2)).isoformat()[:19],
|
|
|
+ 'stacktrace': {
|
|
|
+ 'frames': [{
|
|
|
+ 'module': 'group2'
|
|
|
+ }]
|
|
|
+ },
|
|
|
+ 'message': 'group2',
|
|
|
+ 'tags': {
|
|
|
+ 'priority': priority,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ project_id=self.project.id,
|
|
|
+ )
|
|
|
+ results = self.make_query(
|
|
|
+ search_filter_query='priority:%s' % priority,
|
|
|
+ tags={'priority': priority},
|
|
|
+ sort_by='priority',
|
|
|
+ )
|
|
|
+ assert list(results) == [self.group1, self.group2]
|
|
|
+
|
|
|
def test_project(self):
|
|
|
results = self.make_query([self.create_project(name='other')])
|
|
|
assert set(results) == set([])
|