|
44 | 44 | 'userver_config_testsuite', |
45 | 45 | 'userver_config_secdist', |
46 | 46 | 'userver_config_testsuite_middleware', |
| 47 | + 'userver_config_deadlock_detector', |
47 | 48 | ] |
48 | 49 |
|
49 | 50 | ServiceConfigPatch: TypeAlias = Callable[[dict, dict], None] |
@@ -739,3 +740,34 @@ def patch_config(config_yaml, config_vars): |
739 | 740 | def userver_testsuite_middleware_enabled() -> bool: |
740 | 741 | """Whether testsuite middleware is enabled.""" |
741 | 742 | return True |
| 743 | + |
| 744 | + |
| 745 | +@pytest.fixture(scope='session') |
| 746 | +def userver_config_deadlock_detector(userver_deadlock_detector_mode: str) -> ServiceConfigPatch: |
| 747 | + """ |
| 748 | + Returns a function that adjusts the static configuration file for testsuite. |
| 749 | + Sets the `deadlock_detector` parameter of the `coro_pool` component to the value of |
| 750 | + @ref pytest_userver.plugins.config.userver_deadlock_detector_mode "userver_deadlock_detector_mode" |
| 751 | + fixture. |
| 752 | +
|
| 753 | + @ingroup userver_testsuite_fixtures |
| 754 | + """ |
| 755 | + |
| 756 | + def patch_config(config_yaml, config_vars): |
| 757 | + coro_pool = config_yaml['components_manager'].setdefault('coro_pool', {}) |
| 758 | + coro_pool['deadlock_detector'] = userver_deadlock_detector_mode |
| 759 | + |
| 760 | + return patch_config |
| 761 | + |
| 762 | + |
| 763 | +@pytest.fixture(scope='session') |
| 764 | +def userver_deadlock_detector_mode() -> str: |
| 765 | + """ |
| 766 | + Returns Deadlock detector mode for testsuite. |
| 767 | + Override this fixture to modify the deadlock detector settings. |
| 768 | + By default, it operates in `detect-only` mode. For a full list of available options, refer to the |
| 769 | + `coro_pool.deadlock_detector` parameter in the `components::ManagerControllerComponent`. |
| 770 | +
|
| 771 | + @ingroup userver_testsuite_fixtures |
| 772 | + """ |
| 773 | + return 'detect-only' |
0 commit comments