18
18
from sentry .shared_integrations .exceptions import ApiError
19
19
from sentry .testutils .asserts import assert_failure_metric , assert_halt_metric
20
20
from sentry .testutils .cases import TestCase
21
- from sentry .testutils .helpers import with_feature
22
21
from sentry .testutils .silo import assume_test_silo_mode_of
23
22
from sentry .testutils .skips import requires_snuba
24
23
from sentry .utils .locking import UnableToAcquireLock
@@ -606,7 +605,6 @@ class TestJavaDeriveCodeMappings(LanguageSpecificDeriveCodeMappings):
606
605
platform = "java"
607
606
608
607
def test_short_packages (self ) -> None :
609
- # No code mapping will be stored, however, we get what would have been created
610
608
self ._process_and_assert_configuration_changes (
611
609
repo_trees = {
612
610
REPO1 : [
@@ -634,7 +632,6 @@ def test_short_packages(self) -> None:
634
632
)
635
633
636
634
def test_handles_dollar_sign_in_module (self ) -> None :
637
- # No code mapping will be stored, however, we get what would have been created
638
635
self ._process_and_assert_configuration_changes (
639
636
repo_trees = {REPO1 : ["src/com/example/foo/Bar.kt" ]},
640
637
frames = [
@@ -671,7 +668,6 @@ def test_multiple_configuration_changes(self) -> None:
671
668
],
672
669
)
673
670
674
- @with_feature ({"organizations:auto-source-code-config-java-enabled" : True })
675
671
def test_country_code_tld (self ) -> None :
676
672
# We have two packages for the same domain
677
673
repo_trees = {REPO1 : ["src/uk/co/example/foo/Bar.kt" , "src/uk/co/example/bar/Baz.kt" ]}
@@ -722,7 +718,6 @@ def test_country_code_tld(self) -> None:
722
718
assert event .data ["stacktrace" ]["frames" ][1 ]["module" ] == "uk.co.not-example.baz.qux"
723
719
assert event .data ["stacktrace" ]["frames" ][1 ]["in_app" ] is False
724
720
725
- @with_feature ({"organizations:auto-source-code-config-java-enabled" : True })
726
721
def test_country_code_tld_with_old_granularity (self ) -> None :
727
722
# We have two packages for the same domain
728
723
repo_trees = {REPO1 : ["src/uk/co/example/foo/Bar.kt" , "src/uk/co/example/bar/Baz.kt" ]}
@@ -763,7 +758,6 @@ def test_country_code_tld_with_old_granularity(self) -> None:
763
758
"stack.module:uk.co.example.** +app" ,
764
759
]
765
760
766
- @with_feature ({"organizations:auto-source-code-config-java-enabled" : True })
767
761
def test_do_not_clobber_rules (self ) -> None :
768
762
self ._process_and_assert_configuration_changes (
769
763
repo_trees = {REPO1 : ["src/a/Bar.java" , "src/x/y/Baz.java" ]},
@@ -781,8 +775,7 @@ def test_do_not_clobber_rules(self) -> None:
781
775
expected_new_in_app_stack_trace_rules = ["stack.module:x.y.** +app" ],
782
776
)
783
777
784
- @with_feature ({"organizations:auto-source-code-config-java-enabled" : True })
785
- def test_run_without_dry_run (self ) -> None :
778
+ def test_basic_case (self ) -> None :
786
779
repo_trees = {REPO1 : ["src/com/example/foo/Bar.kt" ]}
787
780
frames = [
788
781
self .frame (module = "com.example.foo.Bar" , abs_path = "Bar.kt" , in_app = False ),
@@ -839,31 +832,22 @@ def test_categorized_frames_are_not_processed(self) -> None:
839
832
# Even though the file is in the repo, it's not processed because it's categorized as internals
840
833
repo_trees = {REPO1 : ["src/android/app/Activity.java" ]}
841
834
frame = self .frame (module = "android.app.Activity" , abs_path = "Activity.java" , in_app = False )
842
- with (
843
- patch (f"{ CLIENT } .get_tree" , side_effect = create_mock_get_tree (repo_trees )),
844
- patch (f"{ CLIENT } .get_remaining_api_requests" , return_value = 500 ),
845
- patch (
846
- f"{ REPO_TREES_INTEGRATION } ._populate_repositories" ,
847
- return_value = mock_populate_repositories (),
848
- ),
849
- ):
850
- event = self .create_event ([frame ], self .platform )
851
- dry_run_code_mappings , in_app_stack_trace_rules = process_event (
852
- self .project .id , event .group_id , event .event_id
835
+ self ._process_and_assert_configuration_changes (
836
+ repo_trees = repo_trees ,
837
+ frames = [frame ],
838
+ platform = self .platform ,
839
+ )
840
+
841
+ # If we remove the category, it will be processed
842
+ with patch (f"{ CODE_ROOT } .stacktraces._check_not_categorized" , return_value = True ):
843
+ self ._process_and_assert_configuration_changes (
844
+ repo_trees = repo_trees ,
845
+ frames = [frame ],
846
+ platform = self .platform ,
847
+ expected_new_code_mappings = [self .code_mapping ("android/app/" , "src/android/app/" )],
848
+ expected_new_in_app_stack_trace_rules = ["stack.module:android.app.** +app" ],
853
849
)
854
- assert dry_run_code_mappings == []
855
- assert in_app_stack_trace_rules == []
856
-
857
- # If we remove the category, it will be processed
858
- with patch (f"{ CODE_ROOT } .stacktraces._check_not_categorized" , return_value = True ):
859
- event = self .create_event ([frame ], self .platform )
860
- dry_run_code_mappings , in_app_stack_trace_rules = process_event (
861
- self .project .id , event .group_id , event .event_id
862
- )
863
- assert dry_run_code_mappings != []
864
- assert in_app_stack_trace_rules != []
865
850
866
- @with_feature ({"organizations:auto-source-code-config-java-enabled" : True })
867
851
def test_unintended_rules_are_removed (self ) -> None :
868
852
"""Test that unintended rules will be removed without affecting other rules"""
869
853
key = "sentry:automatic_grouping_enhancements"
0 commit comments