3
3
from typing import Any , Literal , cast
4
4
from uuid import uuid1
5
5
6
- import pytest
7
-
8
6
from sentry .eventstore .models import Event
9
7
from sentry .seer .similarity .utils import (
10
8
BASE64_ENCODED_PREFIXES ,
11
- MAX_FRAME_COUNT ,
12
9
SEER_ELIGIBLE_PLATFORMS ,
13
- TooManyOnlySystemFramesException ,
14
10
_is_snipped_context_line ,
15
11
event_content_is_seer_eligible ,
16
12
filter_null_from_string ,
@@ -674,18 +670,18 @@ def test_chained_too_many_frames_minified_js_frame_limit(self):
674
670
)
675
671
676
672
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 ."""
678
674
data_chained_exception = copy .deepcopy (self .CHAINED_APP_DATA )
679
675
data_chained_exception ["app" ]["component" ]["values" ][0 ]["values" ] = [
680
676
self .create_exception (
681
677
exception_type_str = "Exception" ,
682
678
exception_value = f"exception { i } message!" ,
683
679
frames = self .create_frames (num_frames = 1 , context_line_factory = lambda i : f"line { i } " ),
684
680
)
685
- for i in range (1 , MAX_FRAME_COUNT + 2 )
681
+ for i in range (1 , 32 )
686
682
]
687
683
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 ):
689
685
assert f"exception { i } message!" in stacktrace_str
690
686
assert "exception 1 message!" not in stacktrace_str
691
687
@@ -714,35 +710,9 @@ def test_no_app_no_system(self):
714
710
stacktrace_str = get_stacktrace_string (data )
715
711
assert stacktrace_str == ""
716
712
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."""
740
715
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
- """
746
716
data_frames = copy .deepcopy (self .BASE_APP_DATA )
747
717
# Create 30 contributing frames, 1-20 -> last 10 should be included
748
718
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):
769
739
for i in range (41 , 61 ):
770
740
num_frames += 1
771
741
assert ("test = " + str (i ) + "!" ) in stacktrace_str
772
- assert num_frames == MAX_FRAME_COUNT
742
+ assert num_frames == 30
773
743
774
744
def test_too_many_frames_minified_js_frame_limit (self ):
775
745
"""Test that we restrict fully-minified stacktraces to 20 frames, and all other stacktraces to 30 frames."""
0 commit comments