33from typing import Any , Literal , cast
44from uuid import uuid1
55
6- import pytest
7-
86from sentry .eventstore .models import Event
97from sentry .seer .similarity .utils import (
108 BASE64_ENCODED_PREFIXES ,
11- MAX_FRAME_COUNT ,
129 SEER_ELIGIBLE_PLATFORMS ,
13- TooManyOnlySystemFramesException ,
1410 _is_snipped_context_line ,
1511 event_content_is_seer_eligible ,
1612 filter_null_from_string ,
@@ -674,18 +670,18 @@ def test_chained_too_many_frames_minified_js_frame_limit(self):
674670 )
675671
676672 def test_chained_too_many_exceptions (self ):
677- """Test that we restrict number of chained exceptions to MAX_FRAME_COUNT ."""
673+ """Test that we restrict number of chained exceptions to 30 ."""
678674 data_chained_exception = copy .deepcopy (self .CHAINED_APP_DATA )
679675 data_chained_exception ["app" ]["component" ]["values" ][0 ]["values" ] = [
680676 self .create_exception (
681677 exception_type_str = "Exception" ,
682678 exception_value = f"exception { i } message!" ,
683679 frames = self .create_frames (num_frames = 1 , context_line_factory = lambda i : f"line { i } " ),
684680 )
685- for i in range (1 , MAX_FRAME_COUNT + 2 )
681+ for i in range (1 , 32 )
686682 ]
687683 stacktrace_str = get_stacktrace_string (data_chained_exception )
688- for i in range (2 , MAX_FRAME_COUNT + 2 ):
684+ for i in range (2 , 32 ):
689685 assert f"exception { i } message!" in stacktrace_str
690686 assert "exception 1 message!" not in stacktrace_str
691687
@@ -714,35 +710,9 @@ def test_no_app_no_system(self):
714710 stacktrace_str = get_stacktrace_string (data )
715711 assert stacktrace_str == ""
716712
717- def test_too_many_system_frames_single_exception (self ):
718- data_system = copy .deepcopy (self .BASE_APP_DATA )
719- data_system ["system" ] = data_system .pop ("app" )
720- data_system ["system" ]["component" ]["values" ][0 ]["values" ][0 ][
721- "values"
722- ] += self .create_frames (MAX_FRAME_COUNT + 1 , True )
723-
724- with pytest .raises (TooManyOnlySystemFramesException ):
725- get_stacktrace_string (data_system )
726-
727- def test_too_many_system_frames_chained_exception (self ):
728- data_system = copy .deepcopy (self .CHAINED_APP_DATA )
729- data_system ["system" ] = data_system .pop ("app" )
730- # Split MAX_FRAME_COUNT across the two exceptions
731- data_system ["system" ]["component" ]["values" ][0 ]["values" ][0 ]["values" ][0 ][
732- "values"
733- ] += self .create_frames (MAX_FRAME_COUNT // 2 , True )
734- data_system ["system" ]["component" ]["values" ][0 ]["values" ][1 ]["values" ][0 ][
735- "values"
736- ] += self .create_frames (MAX_FRAME_COUNT // 2 , True )
737-
738- with pytest .raises (TooManyOnlySystemFramesException ):
739- get_stacktrace_string (data_system )
713+ def test_over_30_contributing_frames (self ):
714+ """Check that when there are over 30 contributing frames, the last 30 are included."""
740715
741- def test_too_many_in_app_contributing_frames (self ):
742- """
743- Check that when there are over MAX_FRAME_COUNT contributing frames, the last MAX_FRAME_COUNT
744- are included.
745- """
746716 data_frames = copy .deepcopy (self .BASE_APP_DATA )
747717 # Create 30 contributing frames, 1-20 -> last 10 should be included
748718 data_frames ["app" ]["component" ]["values" ][0 ]["values" ][0 ]["values" ] = self .create_frames (
@@ -769,7 +739,7 @@ def test_too_many_in_app_contributing_frames(self):
769739 for i in range (41 , 61 ):
770740 num_frames += 1
771741 assert ("test = " + str (i ) + "!" ) in stacktrace_str
772- assert num_frames == MAX_FRAME_COUNT
742+ assert num_frames == 30
773743
774744 def test_too_many_frames_minified_js_frame_limit (self ):
775745 """Test that we restrict fully-minified stacktraces to 20 frames, and all other stacktraces to 30 frames."""
0 commit comments