mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-11 19:56:03 +00:00
fix: restore integration-tests.sh to original (no UV changes needed)
This script runs tests in an already-configured environment, so it doesn't need UV index configuration changes.
This commit is contained in:
parent
23aff83aa9
commit
e494d23658
1 changed files with 72 additions and 61 deletions
|
|
@ -102,7 +102,6 @@ while [[ $# -gt 0 ]]; do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
# Validate required parameters
|
# Validate required parameters
|
||||||
if [[ -z "$STACK_CONFIG" && "$COLLECT_ONLY" == false ]]; then
|
if [[ -z "$STACK_CONFIG" && "$COLLECT_ONLY" == false ]]; then
|
||||||
echo "Error: --stack-config is required"
|
echo "Error: --stack-config is required"
|
||||||
|
|
@ -208,6 +207,15 @@ if [[ "$STACK_CONFIG" == *"server:"* && "$COLLECT_ONLY" == false ]]; then
|
||||||
echo "=== Starting Llama Stack Server ==="
|
echo "=== Starting Llama Stack Server ==="
|
||||||
export LLAMA_STACK_LOG_WIDTH=120
|
export LLAMA_STACK_LOG_WIDTH=120
|
||||||
|
|
||||||
|
# Configure telemetry collector for server mode
|
||||||
|
# Use a fixed port for the OTEL collector so the server can connect to it
|
||||||
|
COLLECTOR_PORT=4317
|
||||||
|
export LLAMA_STACK_TEST_COLLECTOR_PORT="${COLLECTOR_PORT}"
|
||||||
|
export OTEL_EXPORTER_OTLP_ENDPOINT="http://127.0.0.1:${COLLECTOR_PORT}"
|
||||||
|
export OTEL_EXPORTER_OTLP_PROTOCOL="http/protobuf"
|
||||||
|
export OTEL_BSP_SCHEDULE_DELAY="200"
|
||||||
|
export OTEL_BSP_EXPORT_TIMEOUT="2000"
|
||||||
|
|
||||||
# remove "server:" from STACK_CONFIG
|
# remove "server:" from STACK_CONFIG
|
||||||
stack_config=$(echo "$STACK_CONFIG" | sed 's/^server://')
|
stack_config=$(echo "$STACK_CONFIG" | sed 's/^server://')
|
||||||
nohup llama stack run $stack_config >server.log 2>&1 &
|
nohup llama stack run $stack_config >server.log 2>&1 &
|
||||||
|
|
@ -271,16 +279,6 @@ if [[ "$STACK_CONFIG" == *"docker:"* && "$COLLECT_ONLY" == false ]]; then
|
||||||
--build-arg "LLAMA_STACK_DIR=/workspace"
|
--build-arg "LLAMA_STACK_DIR=/workspace"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Pass UV index configuration for release branches
|
|
||||||
if [[ -n "${UV_EXTRA_INDEX_URL:-}" ]]; then
|
|
||||||
echo "Adding UV_EXTRA_INDEX_URL to docker build: $UV_EXTRA_INDEX_URL"
|
|
||||||
build_cmd+=(--build-arg "UV_EXTRA_INDEX_URL=$UV_EXTRA_INDEX_URL")
|
|
||||||
fi
|
|
||||||
if [[ -n "${UV_INDEX_STRATEGY:-}" ]]; then
|
|
||||||
echo "Adding UV_INDEX_STRATEGY to docker build: $UV_INDEX_STRATEGY"
|
|
||||||
build_cmd+=(--build-arg "UV_INDEX_STRATEGY=$UV_INDEX_STRATEGY")
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! "${build_cmd[@]}"; then
|
if ! "${build_cmd[@]}"; then
|
||||||
echo "❌ Failed to build Docker image"
|
echo "❌ Failed to build Docker image"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
@ -294,10 +292,15 @@ if [[ "$STACK_CONFIG" == *"docker:"* && "$COLLECT_ONLY" == false ]]; then
|
||||||
docker stop "$container_name" 2>/dev/null || true
|
docker stop "$container_name" 2>/dev/null || true
|
||||||
docker rm "$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
|
# Build environment variables for docker run
|
||||||
DOCKER_ENV_VARS=""
|
DOCKER_ENV_VARS=""
|
||||||
DOCKER_ENV_VARS="$DOCKER_ENV_VARS -e LLAMA_STACK_TEST_INFERENCE_MODE=$INFERENCE_MODE"
|
DOCKER_ENV_VARS="$DOCKER_ENV_VARS -e LLAMA_STACK_TEST_INFERENCE_MODE=$INFERENCE_MODE"
|
||||||
DOCKER_ENV_VARS="$DOCKER_ENV_VARS -e LLAMA_STACK_TEST_STACK_CONFIG_TYPE=server"
|
DOCKER_ENV_VARS="$DOCKER_ENV_VARS -e LLAMA_STACK_TEST_STACK_CONFIG_TYPE=server"
|
||||||
|
DOCKER_ENV_VARS="$DOCKER_ENV_VARS -e OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:${COLLECTOR_PORT}"
|
||||||
|
|
||||||
# Pass through API keys if they exist
|
# Pass through API keys if they exist
|
||||||
[ -n "${TOGETHER_API_KEY:-}" ] && DOCKER_ENV_VARS="$DOCKER_ENV_VARS -e TOGETHER_API_KEY=$TOGETHER_API_KEY"
|
[ -n "${TOGETHER_API_KEY:-}" ] && DOCKER_ENV_VARS="$DOCKER_ENV_VARS -e TOGETHER_API_KEY=$TOGETHER_API_KEY"
|
||||||
|
|
@ -318,8 +321,20 @@ if [[ "$STACK_CONFIG" == *"docker:"* && "$COLLECT_ONLY" == false ]]; then
|
||||||
fi
|
fi
|
||||||
echo "Using image: $IMAGE_NAME"
|
echo "Using image: $IMAGE_NAME"
|
||||||
|
|
||||||
docker run -d --network host --name "$container_name" \
|
# On macOS/Darwin, --network host doesn't work as expected due to Docker running in a VM
|
||||||
-p $LLAMA_STACK_PORT:$LLAMA_STACK_PORT \
|
# Use regular port mapping instead
|
||||||
|
NETWORK_MODE=""
|
||||||
|
PORT_MAPPINGS=""
|
||||||
|
if [[ "$(uname)" != "Darwin" ]] && [[ "$(uname)" != *"MINGW"* ]]; then
|
||||||
|
NETWORK_MODE="--network host"
|
||||||
|
else
|
||||||
|
# On non-Linux (macOS, Windows), need explicit port mappings for both app and telemetry
|
||||||
|
PORT_MAPPINGS="-p $LLAMA_STACK_PORT:$LLAMA_STACK_PORT -p $COLLECTOR_PORT:$COLLECTOR_PORT"
|
||||||
|
echo "Using bridge networking with port mapping (non-Linux)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
docker run -d $NETWORK_MODE --name "$container_name" \
|
||||||
|
$PORT_MAPPINGS \
|
||||||
$DOCKER_ENV_VARS \
|
$DOCKER_ENV_VARS \
|
||||||
"$IMAGE_NAME" \
|
"$IMAGE_NAME" \
|
||||||
--port $LLAMA_STACK_PORT
|
--port $LLAMA_STACK_PORT
|
||||||
|
|
@ -421,17 +436,13 @@ elif [ $exit_code -eq 5 ]; then
|
||||||
else
|
else
|
||||||
echo "❌ Tests failed"
|
echo "❌ Tests failed"
|
||||||
echo ""
|
echo ""
|
||||||
echo "=== Dumping last 100 lines of logs for debugging ==="
|
|
||||||
|
|
||||||
# Output server or container logs based on stack config
|
# Output server or container logs based on stack config
|
||||||
if [[ "$STACK_CONFIG" == *"server:"* && -f "server.log" ]]; then
|
if [[ "$STACK_CONFIG" == *"server:"* && -f "server.log" ]]; then
|
||||||
echo "--- Last 100 lines of server.log ---"
|
echo "--- Server side failures can be located inside server.log (available from artifacts on CI) ---"
|
||||||
tail -100 server.log
|
|
||||||
elif [[ "$STACK_CONFIG" == *"docker:"* ]]; then
|
elif [[ "$STACK_CONFIG" == *"docker:"* ]]; then
|
||||||
docker_log_file="docker-${DISTRO}-${INFERENCE_MODE}.log"
|
docker_log_file="docker-${DISTRO}-${INFERENCE_MODE}.log"
|
||||||
if [[ -f "$docker_log_file" ]]; then
|
if [[ -f "$docker_log_file" ]]; then
|
||||||
echo "--- Last 100 lines of $docker_log_file ---"
|
echo "--- Server side failures can be located inside $docker_log_file (available from artifacts on CI) ---"
|
||||||
tail -100 "$docker_log_file"
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue