Browse Source

fix(functions): Fix schema for Snuba API (#62881)

Pierre Massat 1 year ago
parent
commit
a95a47199e
1 changed files with 12 additions and 10 deletions
  1. 12 10
      src/sentry/testutils/cases.py

+ 12 - 10
src/sentry/testutils/cases.py

@@ -2172,26 +2172,28 @@ class ProfilesSnubaTestCase(
             profile_context["profile_id"] = uuid4().hex
             profile_context["profile_id"] = uuid4().hex
         profile_id = profile_context.get("profile_id")
         profile_id = profile_context.get("profile_id")
 
 
-        timestamp = transaction["timestamp"]
-
         self.store_event(transaction, project_id=project.id)
         self.store_event(transaction, project_id=project.id)
 
 
+        timestamp = transaction["timestamp"]
         functions = [
         functions = [
-            {**function, "fingerprint": self.function_fingerprint(function)}
+            {
+                **function,
+                "self_times_ns": list(map(int, function["self_times_ns"])),
+                "fingerprint": self.function_fingerprint(function),
+            }
             for function in functions
             for function in functions
         ]
         ]
-
         functions_payload = {
         functions_payload = {
-            "project_id": project.id,
-            "profile_id": profile_id,
-            "transaction_name": transaction["transaction"],
+            "functions": functions,
             # the transaction platform doesn't quite match the
             # the transaction platform doesn't quite match the
             # profile platform, but should be fine for tests
             # profile platform, but should be fine for tests
             "platform": transaction["platform"],
             "platform": transaction["platform"],
-            "functions": functions,
-            "timestamp": timestamp,
-            # TODO: should reflect the org
+            "profile_id": profile_id,
+            "project_id": project.id,
+            "received": int(datetime.now(tz=timezone.utc).timestamp()),
             "retention_days": 90,
             "retention_days": 90,
+            "timestamp": int(timestamp),
+            "transaction_name": transaction["transaction"],
         }
         }
 
 
         if extras is not None:
         if extras is not None: