mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-10-10 13:28:40 +00:00
fix(tests): ensure test isolation in server mode (#3737)
Propagate test IDs from client to server via HTTP headers to maintain proper test isolation when running with server-based stack configs. Without this, recorded/replayed inference requests in server mode would leak across tests. Changes: - Patch client _prepare_request to inject test ID into provider data header - Sync test context from provider data on server side before storage operations - Set LLAMA_STACK_TEST_STACK_CONFIG_TYPE env var based on stack config - Configure console width for cleaner log output in CI - Add SQLITE_STORE_DIR temp directory for test data isolation
This commit is contained in:
parent
96886afaca
commit
79bed44b04
419 changed files with 106801 additions and 35909 deletions
|
@ -124,12 +124,6 @@ echo ""
|
|||
echo "Checking llama packages"
|
||||
uv pip list | grep llama
|
||||
|
||||
# Check storage and memory before tests
|
||||
echo "=== System Resources Before Tests ==="
|
||||
free -h 2>/dev/null || echo "free command not available"
|
||||
df -h
|
||||
echo ""
|
||||
|
||||
# Set environment variables
|
||||
export LLAMA_STACK_CLIENT_TIMEOUT=300
|
||||
|
||||
|
@ -144,6 +138,17 @@ echo "=== Applying Setup Environment Variables ==="
|
|||
|
||||
# the server needs this
|
||||
export LLAMA_STACK_TEST_INFERENCE_MODE="$INFERENCE_MODE"
|
||||
export SQLITE_STORE_DIR=$(mktemp -d)
|
||||
echo "Setting SQLITE_STORE_DIR: $SQLITE_STORE_DIR"
|
||||
|
||||
# Determine stack config type for api_recorder test isolation
|
||||
if [[ "$STACK_CONFIG" == server:* ]]; then
|
||||
export LLAMA_STACK_TEST_STACK_CONFIG_TYPE="server"
|
||||
echo "Setting stack config type: server"
|
||||
else
|
||||
export LLAMA_STACK_TEST_STACK_CONFIG_TYPE="library_client"
|
||||
echo "Setting stack config type: library_client"
|
||||
fi
|
||||
|
||||
SETUP_ENV=$(PYTHONPATH=$THIS_DIR/.. python "$THIS_DIR/get_setup_env.py" --suite "$TEST_SUITE" --setup "$TEST_SETUP" --format bash)
|
||||
echo "Setting up environment variables:"
|
||||
|
@ -186,7 +191,11 @@ if [[ "$STACK_CONFIG" == *"server:"* ]]; then
|
|||
echo "Llama Stack Server is already running, skipping start"
|
||||
else
|
||||
echo "=== Starting Llama Stack Server ==="
|
||||
nohup llama stack run ci-tests > server.log 2>&1 &
|
||||
export LLAMA_STACK_LOG_WIDTH=120
|
||||
|
||||
# remove "server:" from STACK_CONFIG
|
||||
stack_config=$(echo "$STACK_CONFIG" | sed 's/^server://')
|
||||
nohup llama stack run $stack_config > server.log 2>&1 &
|
||||
|
||||
echo "Waiting for Llama Stack Server to start..."
|
||||
for i in {1..30}; do
|
||||
|
@ -277,11 +286,5 @@ else
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# Check storage and memory after tests
|
||||
echo ""
|
||||
echo "=== System Resources After Tests ==="
|
||||
free -h 2>/dev/null || echo "free command not available"
|
||||
df -h
|
||||
|
||||
echo ""
|
||||
echo "=== Integration Tests Complete ==="
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue