Skip to content

Commit da1db7f

Browse files
author
lexeyo
committed
feat userver/testsuite: enable deadlock-detector in testsuite
* Enables deadlock detector in testsuite for all users. * Removes previous internal-only enablement. commit_hash:09d5d6070d18e76156f5385bc567ec56e2e34814
1 parent 85ea042 commit da1db7f

File tree

1 file changed

+32
-0
lines changed
  • testsuite/pytest_plugins/pytest_userver/plugins

1 file changed

+32
-0
lines changed

testsuite/pytest_plugins/pytest_userver/plugins/config.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
'userver_config_testsuite',
4545
'userver_config_secdist',
4646
'userver_config_testsuite_middleware',
47+
'userver_config_deadlock_detector',
4748
]
4849

4950
ServiceConfigPatch: TypeAlias = Callable[[dict, dict], None]
@@ -739,3 +740,34 @@ def patch_config(config_yaml, config_vars):
739740
def userver_testsuite_middleware_enabled() -> bool:
740741
"""Whether testsuite middleware is enabled."""
741742
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

Comments
 (0)