108 service_http_ping_url,
109 service_config_path_temp,
112 service_non_http_health_checks,
115 Configures the health checking to use service_http_ping_url fixture value
116 if it is not None; otherwise uses the service_non_http_health_checks info.
117 Starts the service daemon.
119 @ingroup userver_testsuite_fixtures
121 assert service_http_ping_url
or service_non_http_health_checks.tcp, (
122 '"service_http_ping_url" and "create_health_checker" fixtures '
123 'returned None. Testsuite is unable to detect if the service is ready '
124 'to accept requests.',
127 logger_testsuite.debug(
128 'userver fixture "service_daemon" would check for "%s"',
129 service_non_http_health_checks,
136 async def _checker(*, session, process) -> bool:
137 LocalCounters.attempts += 1
138 new_log_time = time.monotonic()
139 if new_log_time - LocalCounters.last_log_time > 1.0:
140 LocalCounters.last_log_time = new_log_time
141 logger_testsuite.debug(
142 'userver fixture "service_daemon" checking "%s", attempt %s',
143 service_non_http_health_checks,
144 LocalCounters.attempts,
147 return await net.check_availability(service_non_http_health_checks)
149 health_check = _checker
150 if service_http_ping_url:
153 async with create_daemon_scope(
154 args=[str(service_binary),
'--config', str(service_config_path_temp)],
155 ping_url=service_http_ping_url,
156 health_check=health_check,