1
2import pytest
4
5pytest_plugins = ['pytest_userver.plugins.core']
6
7
8@pytest.fixture(name='tcp_service_port', scope='session')
9def _tcp_service_port(service_config) -> int:
10 components = service_config['components_manager']['components']
11 tcp_hello = components.get('tcp-echo')
12 assert tcp_hello, 'No "tcp-echo" component found'
13 return int(tcp_hello['port'])
14
15
16@pytest.fixture(scope='session')
17def service_non_http_health_checks(
18 service_config, tcp_service_port,
19) -> net.HealthChecks:
20 checks = net.get_health_checks_info(service_config)
21 checks.tcp.append(net.HostPort(host='localhost', port=tcp_service_port))
22 return checks
23