From b71a870f047ef30f9e62fa3f5336cebed6a043ee Mon Sep 17 00:00:00 2001 From: Eric Huang Date: Thu, 30 Oct 2025 11:02:27 -0700 Subject: [PATCH] chore: fix tele test # What does this PR do? ## Test Plan --- scripts/integration-tests.sh | 9 +++++---- tests/integration/telemetry/conftest.py | 16 ---------------- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/scripts/integration-tests.sh b/scripts/integration-tests.sh index a09dc8621..c471c8836 100755 --- a/scripts/integration-tests.sh +++ b/scripts/integration-tests.sh @@ -187,6 +187,11 @@ if ! command -v pytest &> /dev/null; then exit 1 fi +# Configure telemetry collector port shared between host and container +COLLECTOR_PORT=4319 +export LLAMA_STACK_TEST_COLLECTOR_PORT="${COLLECTOR_PORT}" +export OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:${COLLECTOR_PORT}" + # Start Llama Stack Server if needed if [[ "$STACK_CONFIG" == *"server:"* && "$COLLECT_ONLY" == false ]]; then stop_server() { @@ -284,10 +289,6 @@ if [[ "$STACK_CONFIG" == *"docker:"* && "$COLLECT_ONLY" == false ]]; then docker stop "$container_name" 2>/dev/null || true docker rm "$container_name" 2>/dev/null || true - # Configure telemetry collector port shared between host and container - COLLECTOR_PORT=4317 - export LLAMA_STACK_TEST_COLLECTOR_PORT="${COLLECTOR_PORT}" - # Build environment variables for docker run DOCKER_ENV_VARS="" DOCKER_ENV_VARS="$DOCKER_ENV_VARS -e LLAMA_STACK_TEST_INFERENCE_MODE=$INFERENCE_MODE" diff --git a/tests/integration/telemetry/conftest.py b/tests/integration/telemetry/conftest.py index 58ac4e0df..087239e33 100644 --- a/tests/integration/telemetry/conftest.py +++ b/tests/integration/telemetry/conftest.py @@ -25,17 +25,6 @@ def telemetry_test_collector(): collector = OtlpHttpTestCollector() except RuntimeError as exc: pytest.skip(str(exc)) - env_overrides = { - "OTEL_EXPORTER_OTLP_ENDPOINT": collector.endpoint, - "OTEL_EXPORTER_OTLP_PROTOCOL": "http/protobuf", - "OTEL_BSP_SCHEDULE_DELAY": "200", - "OTEL_BSP_EXPORT_TIMEOUT": "2000", - } - - previous_env = {key: os.environ.get(key) for key in env_overrides} - - for key, value in env_overrides.items(): - os.environ[key] = value telemetry_module._TRACER_PROVIDER = None @@ -43,11 +32,6 @@ def telemetry_test_collector(): yield collector finally: collector.shutdown() - for key, prior in previous_env.items(): - if prior is None: - os.environ.pop(key, None) - else: - os.environ[key] = prior else: manager = InMemoryTelemetryManager() try: