fix rust tests

This commit is contained in:
Adil Hafeez 2025-05-14 17:15:42 -07:00
parent f60cac27f4
commit 0e2f53426a
No known key found for this signature in database
GPG key ID: 9B18EF7691369645
7 changed files with 165 additions and 26 deletions

View file

@ -3,7 +3,12 @@ import json
import sys
import requests
from cli.consts import ARCHGW_DOCKER_IMAGE, ARCHGW_DOCKER_NAME
from cli.consts import (
ARCHGW_DOCKER_IMAGE,
ARCHGW_DOCKER_NAME,
BRIGHTSTAFF_DOCKER_IMAGE,
BRIGHTSTAFF_DOCKER_NAME,
)
from cli.utils import getLogger
log = getLogger(__name__)
@ -81,6 +86,48 @@ def docker_start_archgw_detached(
return result.returncode, result.stdout, result.stderr
def docker_start_brightstaff_detached(
arch_config_file: str,
env: dict,
) -> str:
env_args = [item for key, value in env.items() for item in ["-e", f"{key}={value}"]]
port_mappings = [
"9091:9091",
]
port_mappings_args = [item for port in port_mappings for item in ("-p", port)]
volume_mappings = [
f"{arch_config_file}:/app/arch_config.yaml:ro",
]
volume_mappings_args = [
item for volume in volume_mappings for item in ("-v", volume)
]
llm_provider_endpoint = env.get(
"LLM_PROVIDER_ENDPOINT", "http://host.docker.internal:12000/v1/chat/completions"
)
options = [
"docker",
"run",
"-d",
"--name",
BRIGHTSTAFF_DOCKER_NAME,
*port_mappings_args,
*volume_mappings_args,
*env_args,
"-e",
f"LLM_PROVIDER_ENDPOINT={llm_provider_endpoint}",
"--add-host",
"host.docker.internal:host-gateway",
BRIGHTSTAFF_DOCKER_IMAGE,
]
result = subprocess.run(options, capture_output=True, text=True, check=False)
return result.returncode, result.stdout, result.stderr
def health_check_endpoint(endpoint: str) -> bool:
try:
response = requests.get(endpoint)
@ -91,7 +138,7 @@ def health_check_endpoint(endpoint: str) -> bool:
return False
def stream_gateway_logs(follow):
def stream_gateway_logs(follow, service="archgw"):
"""
Stream logs from the arch gateway service.
"""
@ -100,7 +147,7 @@ def stream_gateway_logs(follow):
options = ["docker", "logs"]
if follow:
options.append("-f")
options.append(ARCHGW_DOCKER_NAME)
options.append(service)
try:
# Run `docker-compose logs` to stream logs from the gateway service
subprocess.run(