Skip to content

Commit

Permalink
add test for REPLAY_OVERFLOW_SESSIONS_ENABLED=False
Browse files Browse the repository at this point in the history
  • Loading branch information
xvello committed Mar 7, 2024
1 parent 89ef8a6 commit 70517a1
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions posthog/api/test/test_capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -1637,6 +1637,26 @@ def test_recording_ingestion_can_overflow_from_redis_instructions(self, kafka_pr
topic_counter = Counter([call[1]["topic"] for call in kafka_produce.call_args_list])
assert topic_counter == Counter({KAFKA_SESSION_RECORDING_SNAPSHOT_ITEM_EVENTS: 1})

@patch("posthog.kafka_client.client._KafkaProducer.produce")
def test_recording_ingestion_ignores_overflow_from_redis_if_disabled(self, kafka_produce) -> None:
with self.settings(
SESSION_RECORDING_KAFKA_MAX_REQUEST_SIZE_BYTES=20480, REPLAY_OVERFLOW_SESSIONS_ENABLED=False
):
redis = get_client()
redis.zadd(
"@posthog/capture-overflow/replay",
{
"overflowing": timezone.now().timestamp() + 1000,
},
)

# Session is currently overflowing but REPLAY_OVERFLOW_SESSIONS_ENABLED is false
self._send_august_2023_version_session_recording_event(
event_data=large_data_array, session_id="overflowing"
)
topic_counter = Counter([call[1]["topic"] for call in kafka_produce.call_args_list])
assert topic_counter == Counter({KAFKA_SESSION_RECORDING_SNAPSHOT_ITEM_EVENTS: 1})

@patch("posthog.kafka_client.client._KafkaProducer.produce")
def test_recording_ingestion_can_write_headers_with_the_message(self, kafka_produce: MagicMock) -> None:
with self.settings(
Expand Down

0 comments on commit 70517a1

Please sign in to comment.