Skip to content

Commit 194f856

Browse files
authored
tests(auto_config): Validate two more cases (#89489)
Some developers may have marked their frames as in-app via includes and created code mappings.
1 parent 70d111d commit 194f856

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

tests/sentry/issues/auto_source_code_config/test_process_event.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,35 @@ def test_auto_source_code_config_no_normalization(self) -> None:
617617
class TestJavaDeriveCodeMappings(LanguageSpecificDeriveCodeMappings):
618618
platform = "java"
619619

620+
def test_marked_in_app_already(self) -> None:
621+
self._process_and_assert_configuration_changes(
622+
repo_trees={REPO1: ["src/com/example/foo/Bar.kt"]},
623+
# The developer may have marked the frame as in-app in the SDK
624+
frames=[self.frame_from_module("com.example.foo.Bar", "Bar.kt", in_app=True)],
625+
platform=self.platform,
626+
expected_new_code_mappings=[self.code_mapping("com/example/", "src/com/example/")],
627+
expected_new_in_app_stack_trace_rules=[
628+
"stack.module:com.example.** +app",
629+
],
630+
)
631+
632+
def test_marked_in_app_and_code_mapping_already_exists(self) -> None:
633+
# The developer may have already created the code mapping and repository
634+
self.create_repo_and_code_mapping("REPO1", "com/example/", "src/com/example/")
635+
self._process_and_assert_configuration_changes(
636+
repo_trees={REPO1: ["src/com/example/foo/Bar.kt"]},
637+
# The developer may have marked the frame as in-app in the SDK
638+
frames=[self.frame_from_module("com.example.foo.Bar", "Bar.kt", in_app=True)],
639+
platform=self.platform,
640+
# We're not expecting to create anything new
641+
expected_new_code_mappings=[],
642+
# The in-app rule will still be created
643+
expected_new_in_app_stack_trace_rules=[
644+
"stack.module:com.example.** +app",
645+
],
646+
)
647+
assert RepositoryProjectPathConfig.objects.count() == 1
648+
620649
def test_short_packages(self) -> None:
621650
self._process_and_assert_configuration_changes(
622651
repo_trees={

0 commit comments

Comments
 (0)