Skip to content

Commit 73fa662

Browse files
DmitriyHapolukhin
authored andcommitted
feat testsuite: add service_start_timeout fixture
The fixture `service_start_timeout` is necessary to adjust service start timeout, because service start duration can be any. --- Pull Request resolved: #1072 Co-authored-by: antoshkka <[email protected]> commit_hash:d20bd4415eecf4364aae40aaa57ae1e628736522
1 parent 32d4545 commit 73fa662

File tree

1 file changed

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

1 file changed

+18
-0
lines changed

testsuite/pytest_plugins/pytest_userver/plugins/service.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,19 @@ def service_non_http_health_checks( # pylint: disable=invalid-name
9595
return net.get_health_checks_info(service_config)
9696

9797

98+
@pytest.fixture(scope='session')
99+
def service_start_timeout() -> float:
100+
"""
101+
Returns service start timeout in seconds.
102+
103+
Override this fixture to change the service start timeout.
104+
105+
@ingroup userver_testsuite_fixtures
106+
"""
107+
108+
return 100.0
109+
110+
98111
@pytest.fixture(scope='session')
99112
async def service_daemon_scope(
100113
create_daemon_scope,
@@ -104,6 +117,7 @@ async def service_daemon_scope(
104117
service_config_path_temp,
105118
service_binary,
106119
service_non_http_health_checks,
120+
service_start_timeout,
107121
):
108122
"""
109123
Prepares the start of the service daemon.
@@ -145,11 +159,15 @@ async def _checker(*, session, process) -> bool:
145159
if service_http_ping_url:
146160
health_check = None
147161

162+
# In yandex-taxi-testsuite, each poll retry duration is 0.05 seconds.
163+
poll_retries = int(service_start_timeout / 0.05)
164+
148165
async with create_daemon_scope(
149166
args=[str(service_binary), '--config', str(service_config_path_temp)],
150167
ping_url=service_http_ping_url,
151168
health_check=health_check,
152169
env=service_env,
170+
poll_retries=poll_retries,
153171
) as scope:
154172
yield scope
155173

0 commit comments

Comments
 (0)