Browse Source

ref: Bump Relay to 0.5.1 (#16753)

* ref: Update sentry-relay

* fix: Fix EventManager tests after Relay update

* wip on fixing snuba tests
Markus Unterwaditzer 5 years ago
parent
commit
f613850990

+ 1 - 1
requirements-base.txt

@@ -66,7 +66,7 @@ redis>=2.10.3,<2.10.6
 requests-oauthlib==1.2.0
 requests[security]>=2.20.0,<2.21.0
 selenium==3.141.0
-sentry-relay>=0.5.0,<0.5.1
+sentry-relay>=0.5.1,<0.6.0
 sentry-sdk>=0.13.5
 setproctitle>=1.1.7,<1.2.0
 simplejson>=3.2.0,<3.9.0

+ 3 - 0
src/sentry/event_manager.py

@@ -282,6 +282,7 @@ class EventManager(object):
         is_renormalize=False,
         remove_other=None,
         project_config=None,
+        sent_at=None,
     ):
         self._data = _decode_event(data, content_encoding=content_encoding)
         self.version = version
@@ -302,6 +303,7 @@ class EventManager(object):
         self._remove_other = remove_other
         self._normalized = False
         self.project_config = project_config
+        self.sent_at = sent_at
 
     def process_csp_report(self):
         """Only called from the CSP report endpoint."""
@@ -369,6 +371,7 @@ class EventManager(object):
             is_renormalize=self._is_renormalize,
             remove_other=self._remove_other,
             normalize_user_agent=True,
+            sent_at=self.sent_at.isoformat() if self.sent_at is not None else None,
             **DEFAULT_STORE_NORMALIZER_ARGS
         )
 

+ 4 - 2
src/sentry/testutils/factories.py

@@ -466,10 +466,12 @@ class Factories(object):
         return useremail
 
     @staticmethod
-    def store_event(data, project_id, assert_no_errors=True):
+    def store_event(data, project_id, assert_no_errors=True, sent_at=None):
         # Like `create_event`, but closer to how events are actually
         # ingested. Prefer to use this method over `create_event`
-        manager = EventManager(data)
+        if sent_at is None:
+            sent_at = timezone.now()
+        manager = EventManager(data, sent_at=sent_at)
         manager.normalize()
         if assert_no_errors:
             errors = manager.get_data().get("errors")

+ 3 - 0
tests/sentry/event_manager/test_event_manager.py

@@ -898,6 +898,7 @@ class EventManagerTest(TestCase):
                         }
                     },
                     "spans": [],
+                    "timestamp": "2019-06-14T14:01:40Z",
                     "start_timestamp": "2019-06-14T14:01:40Z",
                     "type": "transaction",
                 }
@@ -1119,6 +1120,7 @@ class EventManagerTest(TestCase):
                     }
                 },
                 spans=[],
+                timestamp="2019-06-14T14:01:40Z",
                 start_timestamp="2019-06-14T14:01:40Z",
                 type="transaction",
                 platform="python",
@@ -1153,6 +1155,7 @@ class EventManagerTest(TestCase):
                     }
                 },
                 spans=[],
+                timestamp="2019-06-14T14:01:40Z",
                 start_timestamp="2019-06-14T14:01:40Z",
                 type="transaction",
                 platform="python",