def test_discover_field_parsing(insta_snapshot): rules = FingerprintingRules.from_config_string(""" # This is a config error.type:DatabaseUnavailable -> DatabaseUnavailable stack.function:assertion_failed stack.module:foo -> AssertionFailed, foo app:true -> aha app:true -> {{ default }} """) assert rules._to_config_structure() == { "rules": [ { "matchers": [["type", "DatabaseUnavailable"]], "fingerprint": ["DatabaseUnavailable"] }, { "matchers": [["function", "assertion_failed"], ["module", "foo"]], "fingerprint": ["AssertionFailed", "foo"], }, { "matchers": [["app", "true"]], "fingerprint": ["aha"] }, { "matchers": [["app", "true"]], "fingerprint": ["{{ default }}"] }, ], "version": 1, } assert (FingerprintingRules._from_config_structure( rules._to_config_structure())._to_config_structure() == rules._to_config_structure())
def test_basic_parsing(insta_snapshot): rules = FingerprintingRules.from_config_string(''' # This is a config type:DatabaseUnavailable -> DatabaseUnavailable function:assertion_failed module:foo -> AssertionFailed, foo app:true -> aha app:true -> {{ default }} ''') assert rules._to_config_structure() == { 'rules': [ {'matchers': [['type', 'DatabaseUnavailable']], 'fingerprint': ['DatabaseUnavailable']}, {'matchers': [['function', 'assertion_failed'], ['module', 'foo']], 'fingerprint': ['AssertionFailed', 'foo']}, {'matchers': [['app', 'true']], 'fingerprint': ['aha']}, {'matchers': [['app', 'true']], 'fingerprint': ['{{ default }}']}, ], 'version': 1 } assert FingerprintingRules._from_config_structure( rules._to_config_structure())._to_config_structure() == rules._to_config_structure()
def test_basic_parsing(insta_snapshot): rules = FingerprintingRules.from_config_string( """ # This is a config type:DatabaseUnavailable -> DatabaseUnavailable function:assertion_failed module:foo -> AssertionFailed, foo app:true -> aha app:true -> {{ default }} !path:**/foo/** -> everything !"path":**/foo/** -> everything logger:sentry.* -> logger-, {{ logger }} """ ) assert rules._to_config_structure() == { "rules": [ {"matchers": [["type", "DatabaseUnavailable"]], "fingerprint": ["DatabaseUnavailable"]}, { "matchers": [["function", "assertion_failed"], ["module", "foo"]], "fingerprint": ["AssertionFailed", "foo"], }, {"matchers": [["app", "true"]], "fingerprint": ["aha"]}, {"matchers": [["app", "true"]], "fingerprint": ["{{ default }}"]}, {"matchers": [["!path", "**/foo/**"]], "fingerprint": ["everything"]}, {"matchers": [["!path", "**/foo/**"]], "fingerprint": ["everything"]}, {"matchers": [["logger", "sentry.*"]], "fingerprint": ["logger-", "{{ logger }}"]}, ], "version": 1, } assert ( FingerprintingRules._from_config_structure( rules._to_config_structure() )._to_config_structure() == rules._to_config_structure() )
def test_basic_parsing(insta_snapshot): rules = FingerprintingRules.from_config_string(''' # This is a config type:DatabaseUnavailable -> DatabaseUnavailable function:assertion_failed module:foo -> AssertionFailed, foo app:true -> aha ''') assert rules._to_config_structure() == { 'rules': [ {'matchers': [['type', 'DatabaseUnavailable']], 'fingerprint': ['DatabaseUnavailable']}, {'matchers': [['function', 'assertion_failed'], ['module', 'foo']], 'fingerprint': ['AssertionFailed', 'foo']}, {'matchers': [['app', 'true']], 'fingerprint': ['aha']}, ], 'version': 1 } assert FingerprintingRules._from_config_structure( rules._to_config_structure())._to_config_structure() == rules._to_config_structure()