|
@@ -3,6 +3,7 @@ from uuid import uuid4
|
|
|
|
|
|
from django.urls import reverse
|
|
|
|
|
|
+from sentry.exceptions import InvalidSearchQuery
|
|
|
from sentry.testutils.cases import APITestCase, BaseSpansTestCase
|
|
|
from sentry.testutils.helpers.datetime import before_now
|
|
|
|
|
@@ -840,6 +841,34 @@ class OrganizationSpansTagKeyValuesEndpointTest(BaseSpansTestCase, APITestCase):
|
|
|
assert response.status_code == 200, response.data
|
|
|
assert response.data == []
|
|
|
|
|
|
+ @mock.patch(
|
|
|
+ "sentry.api.endpoints.organization_spans_fields.EAPSpanFieldValuesAutocompletionExecutor.execute",
|
|
|
+ side_effect=InvalidSearchQuery,
|
|
|
+ )
|
|
|
+ @mock.patch(
|
|
|
+ "sentry.api.endpoints.organization_spans_fields.SpanFieldValuesAutocompletionExecutor.execute",
|
|
|
+ side_effect=InvalidSearchQuery,
|
|
|
+ )
|
|
|
+ def test_invalid_query(self, mock_executor_1, mock_executor_2):
|
|
|
+ timestamp = before_now(days=0, minutes=10).replace(microsecond=0)
|
|
|
+ self.store_segment(
|
|
|
+ self.project.id,
|
|
|
+ uuid4().hex,
|
|
|
+ uuid4().hex,
|
|
|
+ span_id=uuid4().hex[:16],
|
|
|
+ organization_id=self.organization.id,
|
|
|
+ parent_span_id=None,
|
|
|
+ timestamp=timestamp,
|
|
|
+ transaction="foo",
|
|
|
+ duration=100,
|
|
|
+ exclusive_time=100,
|
|
|
+ tags={"tag": "foo"},
|
|
|
+ is_eap=self.is_eap,
|
|
|
+ )
|
|
|
+
|
|
|
+ response = self.do_request("tag")
|
|
|
+ assert response.status_code == 400, response.data
|
|
|
+
|
|
|
|
|
|
class OrganizationEAPSpansTagKeyValuesEndpointTest(OrganizationSpansTagKeyValuesEndpointTest):
|
|
|
is_eap = True
|