diff --git a/tests/sentry/ingest/ingest_consumer/test_ingest_consumer_processing.py b/tests/sentry/ingest/ingest_consumer/test_ingest_consumer_processing.py index e4cd69ed814f0..f0aa650a9f98b 100644 --- a/tests/sentry/ingest/ingest_consumer/test_ingest_consumer_processing.py +++ b/tests/sentry/ingest/ingest_consumer/test_ingest_consumer_processing.py @@ -160,6 +160,60 @@ def test_transactions_spawn_save_event_transaction( project_id=project_id, ) +from unittest.mock import patch +from sentry.utils import event_tracker + +@patch('event_tracker.is_tracked', return_value=True) +@django_db_all +def test_transactions_tracks_save_event_transaction( + default_project, + task_runner, + preprocess_event, + save_event_transaction, +): + project_id = default_project.id + now = datetime.datetime.now() + event = { + "type": "transaction", + "timestamp": now.isoformat(), + "start_timestamp": now.isoformat(), + "spans": [], + "contexts": { + "trace": { + "parent_span_id": "8988cec7cc0779c1", + "type": "trace", + "op": "foobar", + "trace_id": "a7d67cf796774551a95be6543cacd459", + "span_id": "babaae0d4b7512d9", + "status": "ok", + } + }, + } + payload = get_normalized_event(event, default_project) + event_id = payload["event_id"] + start_time = time.time() - 3600 + process_event( + ConsumerType.Events, + { + "payload": orjson.dumps(payload).decode(), + "start_time": start_time, + "event_id": event_id, + "project_id": project_id, + "remote_addr": "127.0.0.1", + }, + project=default_project, + ) + assert save_event_transaction.delay.call_args[1]["is_tracked"] == True + + # assert not len(preprocess_event) + # assert save_event_transaction.delay.call_args[0] == () + # assert save_event_transaction.delay.call_args[1] == dict( + # cache_key=f"e:{event_id}:{project_id}", + # data=None, + # start_time=start_time, + # event_id=event_id, + # project_id=project_id, + # ) @django_db_all def test_accountant_transaction(default_project):