Before this fix, the Sentry module sent events for WARNING- level logs, even if sentry_logging_level was registered as "error" or higher. The fix itself is minor: setup of the integration mistakenly set the hardcoded WARNING level to the event handler and the sentry_logging_level to the breadcrumb handler, when they should have been the other way around. The largest part of the diff is a reworking of the tests in order to properly replicate the issue: * The test previously emitted a fake log event directly using the integration's handler's emit-method, which skipped the part of the logic that actually filters based on logging level. This has been changed to use a bespoke NoopHandler and dedicated Logger, so that the tests can emit "actual logs" and test Sentry as accurately as possible. * The tests were not configured to use a non-default logging level, thus making it so that none of them caught the fact we were basically hard-coding the setting to WARNING-level. The tests now set the logging level to ERROR in order to make sure the configuration parameter works when it is non-default. * Changes to configuration (especially ignored loggers) were leaking from one test into others. The tests were directly mutating the `odoo.tools.config.options` mapping, without resetting it afterward, leaving the changes in place for subsequent tests. Introduced a helper method `patch_config` that can be used to patch the config object so that the patch is undone at the end of the test. |
||
---|---|---|
.. | ||
__init__.py | ||
test_client.py | ||
test_logutils.py |