server: tests - allow print on debug
This commit is contained in:
parent
124ca773c6
commit
5957a2dbcb
1 changed files with 7 additions and 4 deletions
|
@ -24,6 +24,7 @@ def step_server_config(context, server_fqdn, server_port):
|
||||||
|
|
||||||
context.base_url = f'http://{context.server_fqdn}:{context.server_port}'
|
context.base_url = f'http://{context.server_fqdn}:{context.server_port}'
|
||||||
|
|
||||||
|
context.debug = 'DEBUG' in os.environ and os.environ['DEBUG'] == 'ON'
|
||||||
context.model_alias = None
|
context.model_alias = None
|
||||||
context.n_ctx = None
|
context.n_ctx = None
|
||||||
context.n_predict = None
|
context.n_predict = None
|
||||||
|
@ -593,7 +594,8 @@ async def wait_for_health_status(context,
|
||||||
slots_idle=None,
|
slots_idle=None,
|
||||||
slots_processing=None,
|
slots_processing=None,
|
||||||
expected_slots=None):
|
expected_slots=None):
|
||||||
print(f"Starting checking for health for expected_health_status={expected_health_status}")
|
if context.debug:
|
||||||
|
print(f"Starting checking for health for expected_health_status={expected_health_status}")
|
||||||
timeout = 3 # seconds
|
timeout = 3 # seconds
|
||||||
interval = 0.5
|
interval = 0.5
|
||||||
counter = 0
|
counter = 0
|
||||||
|
@ -602,8 +604,9 @@ async def wait_for_health_status(context,
|
||||||
async with await session.get(f'{base_url}/health', params=params) as health_response:
|
async with await session.get(f'{base_url}/health', params=params) as health_response:
|
||||||
status_code = health_response.status
|
status_code = health_response.status
|
||||||
health = await health_response.json()
|
health = await health_response.json()
|
||||||
print(f"HEALTH - response for expected health status='{expected_health_status}' on "
|
if context.debug:
|
||||||
f"'{base_url}/health'?{params} is {health}")
|
print(f"HEALTH - response for expected health status='{expected_health_status}' on "
|
||||||
|
f"'{base_url}/health'?{params} is {health}")
|
||||||
if (status_code == expected_http_status_code
|
if (status_code == expected_http_status_code
|
||||||
and health['status'] == expected_health_status
|
and health['status'] == expected_health_status
|
||||||
and (slots_idle is None or health['slots_idle'] == slots_idle)
|
and (slots_idle is None or health['slots_idle'] == slots_idle)
|
||||||
|
@ -683,7 +686,7 @@ def start_server_background(context):
|
||||||
server_args.extend(['--n-predict', context.n_server_predict])
|
server_args.extend(['--n-predict', context.n_server_predict])
|
||||||
if context.server_api_key is not None:
|
if context.server_api_key is not None:
|
||||||
server_args.extend(['--api-key', context.server_api_key])
|
server_args.extend(['--api-key', context.server_api_key])
|
||||||
if 'DEBUG' in os.environ and os.environ['DEBUG'] == 'ON':
|
if context.debug:
|
||||||
server_args.append('--verbose')
|
server_args.append('--verbose')
|
||||||
print(f"starting server with: {context.server_path}", *server_args)
|
print(f"starting server with: {context.server_path}", *server_args)
|
||||||
context.server_process = subprocess.Popen(
|
context.server_process = subprocess.Popen(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue