-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(sdk-crashes): Add ReactNative options
Add ReactNative options as a first step to enable SDK crash detection for ReactNative. As the sample rate is 0.0 and no config for ReactNative exists, this PR doesn't change any behavior.
- Loading branch information
1 parent
de2bdc9
commit e868538
Showing
4 changed files
with
100 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
tests/sentry/utils/sdk_crashes/test_build_sdk_crash_detection_configs.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
from sentry.testutils.helpers.options import override_options | ||
from sentry.utils.sdk_crashes.build_sdk_crash_detection_configs import ( | ||
build_sdk_crash_detection_configs, | ||
) | ||
from sentry.utils.sdk_crashes.sdk_crash_detection_config import SDKCrashDetectionConfig, SdkName | ||
|
||
|
||
@override_options( | ||
{ | ||
"issues.sdk_crash_detection.cocoa.project_id": 1, | ||
"issues.sdk_crash_detection.cocoa.sample_rate": 0.1, | ||
"issues.sdk_crash_detection.react-native.project_id": 2, | ||
"issues.sdk_crash_detection.react-native.sample_rate": 0.2, | ||
} | ||
) | ||
def test_build_sdk_crash_detection_configs(): | ||
configs = build_sdk_crash_detection_configs() | ||
|
||
assert configs == [ | ||
SDKCrashDetectionConfig(sdk_name=SdkName.Cocoa, project_id=1, sample_rate=0.1), | ||
SDKCrashDetectionConfig(sdk_name=SdkName.ReactNative, project_id=2, sample_rate=0.2), | ||
] | ||
|
||
|
||
@override_options( | ||
{ | ||
"issues.sdk_crash_detection.cocoa.project_id": None, | ||
"issues.sdk_crash_detection.cocoa.sample_rate": None, | ||
"issues.sdk_crash_detection.react-native.project_id": 2, | ||
"issues.sdk_crash_detection.react-native.sample_rate": 0.2, | ||
} | ||
) | ||
def test_build_sdk_crash_detection_configs_only_react_native(): | ||
configs = build_sdk_crash_detection_configs() | ||
|
||
assert configs == [ | ||
SDKCrashDetectionConfig(sdk_name=SdkName.ReactNative, project_id=2, sample_rate=0.2), | ||
] | ||
|
||
|
||
@override_options( | ||
{ | ||
"issues.sdk_crash_detection.cocoa.project_id": 1.0, | ||
"issues.sdk_crash_detection.cocoa.sample_rate": None, | ||
"issues.sdk_crash_detection.react-native.project_id": 2, | ||
"issues.sdk_crash_detection.react-native.sample_rate": 0.2, | ||
} | ||
) | ||
def test_build_sdk_crash_detection_configs_no_sample_rate(): | ||
configs = build_sdk_crash_detection_configs() | ||
|
||
assert configs == [ | ||
SDKCrashDetectionConfig(sdk_name=SdkName.ReactNative, project_id=2, sample_rate=0.2), | ||
] | ||
|
||
|
||
@override_options( | ||
{ | ||
"issues.sdk_crash_detection.cocoa.project_id": None, | ||
"issues.sdk_crash_detection.cocoa.sample_rate": None, | ||
"issues.sdk_crash_detection.react-native.project_id": None, | ||
"issues.sdk_crash_detection.react-native.sample_rate": None, | ||
} | ||
) | ||
def test_build_sdk_crash_detection_configs_no_configs(): | ||
assert len(build_sdk_crash_detection_configs()) == 0 |