1818from sentry .shared_integrations .exceptions import ApiError
1919from sentry .testutils .asserts import assert_failure_metric , assert_halt_metric
2020from sentry .testutils .cases import TestCase
21- from sentry .testutils .helpers import with_feature
2221from sentry .testutils .silo import assume_test_silo_mode_of
2322from sentry .testutils .skips import requires_snuba
2423from sentry .utils .locking import UnableToAcquireLock
@@ -606,7 +605,6 @@ class TestJavaDeriveCodeMappings(LanguageSpecificDeriveCodeMappings):
606605 platform = "java"
607606
608607 def test_short_packages (self ) -> None :
609- # No code mapping will be stored, however, we get what would have been created
610608 self ._process_and_assert_configuration_changes (
611609 repo_trees = {
612610 REPO1 : [
@@ -634,7 +632,6 @@ def test_short_packages(self) -> None:
634632 )
635633
636634 def test_handles_dollar_sign_in_module (self ) -> None :
637- # No code mapping will be stored, however, we get what would have been created
638635 self ._process_and_assert_configuration_changes (
639636 repo_trees = {REPO1 : ["src/com/example/foo/Bar.kt" ]},
640637 frames = [
@@ -671,7 +668,6 @@ def test_multiple_configuration_changes(self) -> None:
671668 ],
672669 )
673670
674- @with_feature ({"organizations:auto-source-code-config-java-enabled" : True })
675671 def test_country_code_tld (self ) -> None :
676672 # We have two packages for the same domain
677673 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:
722718 assert event .data ["stacktrace" ]["frames" ][1 ]["module" ] == "uk.co.not-example.baz.qux"
723719 assert event .data ["stacktrace" ]["frames" ][1 ]["in_app" ] is False
724720
725- @with_feature ({"organizations:auto-source-code-config-java-enabled" : True })
726721 def test_country_code_tld_with_old_granularity (self ) -> None :
727722 # We have two packages for the same domain
728723 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:
763758 "stack.module:uk.co.example.** +app" ,
764759 ]
765760
766- @with_feature ({"organizations:auto-source-code-config-java-enabled" : True })
767761 def test_do_not_clobber_rules (self ) -> None :
768762 self ._process_and_assert_configuration_changes (
769763 repo_trees = {REPO1 : ["src/a/Bar.java" , "src/x/y/Baz.java" ]},
@@ -781,8 +775,7 @@ def test_do_not_clobber_rules(self) -> None:
781775 expected_new_in_app_stack_trace_rules = ["stack.module:x.y.** +app" ],
782776 )
783777
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 :
786779 repo_trees = {REPO1 : ["src/com/example/foo/Bar.kt" ]}
787780 frames = [
788781 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:
839832 # Even though the file is in the repo, it's not processed because it's categorized as internals
840833 repo_trees = {REPO1 : ["src/android/app/Activity.java" ]}
841834 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" ],
853849 )
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 != []
865850
866- @with_feature ({"organizations:auto-source-code-config-java-enabled" : True })
867851 def test_unintended_rules_are_removed (self ) -> None :
868852 """Test that unintended rules will be removed without affecting other rules"""
869853 key = "sentry:automatic_grouping_enhancements"
0 commit comments