Skip to content

Commit

Permalink
fix(issue-platform): use isformat for default received
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshFerge committed Oct 6, 2023
1 parent 7e22d71 commit 936848b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/sentry/issues/occurrence_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def _get_kwargs(payload: Mapping[str, Any]) -> Mapping[str, Any]:
"level": occurrence_data["level"],
"project_id": event_payload.get("project_id"),
"platform": event_payload.get("platform"),
"received": event_payload.get("received", timezone.now()),
"received": event_payload.get("received", timezone.now().isoformat()),
"tags": event_payload.get("tags"),
"timestamp": event_payload.get("timestamp"),
}
Expand Down
21 changes: 21 additions & 0 deletions tests/sentry/issues/test_occurrence_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,27 @@ def test_mismatch_event_ids(self) -> None:
with self.feature("organizations:profile-file-io-main-thread-ingest"):
_process_message(message)

@django_db_all
def test_occurrence_consumer_no_received(self) -> None:
message = get_test_message(self.project.id)
del message["event"]["received"]
with self.feature("organizations:profile-file-io-main-thread-ingest"):
result = _process_message(message)
assert result is not None
occurrence = result[0]

fetched_occurrence = IssueOccurrence.fetch(occurrence.id, self.project.id)
assert fetched_occurrence is not None
self.assert_occurrences_identical(occurrence, fetched_occurrence)
assert fetched_occurrence.event_id is not None
fetched_event = self.eventstore.get_event_by_id(
self.project.id, fetched_occurrence.event_id
)
assert fetched_event is not None
assert fetched_event.get_event_type() == "generic"

assert Group.objects.filter(grouphash__hash=occurrence.fingerprint[0]).exists()


class IssueOccurrenceLookupEventIdTest(IssueOccurrenceTestBase):
def test_lookup_event_doesnt_exist(self) -> None:
Expand Down

0 comments on commit 936848b

Please sign in to comment.