This directory contains integration tests for the Rust router and Rust babysitter implementations.
-
Build the router and babysitter:
cd ../../.. cd rust cargo build --release --bin infini-router --bin infini-babysitter
-
Setup Integration Test Environment: The tests use a dedicated conda environment. Setup the environment:
cd rust/tests/integration bash setup_env.shThis will create a conda environment named
infinilm-integration-testwith all required dependencies (aiohttp, requests).Alternatively, you can manually create the environment:
conda create -n infinilm-integration-test python=3.10 -y conda run -n infinilm-integration-test pip install aiohttp requests
A Python-based mock service that simulates a backend InfiniLM service with:
- OpenAI API compatibility (
/v1/chat/completions) - Model support configuration
- Streaming response support
- Health check endpoint (babysitter)
- Automatic registration with service registry
Usage:
python3 mock_service.py \
--name "service-name" \
--port 6001 \
--models "model-a,model-b" \
--registry-url "http://127.0.0.1:8901"Tests the router with mock services directly (without babysitter):
- Starts a service registry
- Starts multiple mock services with different models
- Starts the Rust router
- Tests various scenarios:
- Model aggregation
- Model-aware routing
- Load balancing
- Unsupported model handling
- Streaming responses
- Service discovery
- Health checks
Usage:
cd rust/tests/integration
bash test_integration.shTests the full stack with Rust babysitter managing mock services:
- Starts a service registry
- Starts multiple Rust babysitters (each managing a mock service)
- Starts the Rust router
- Tests the complete flow:
- Babysitter health endpoints
- Babysitter /models and /info endpoints
- Service registration via babysitter
- Model aggregation
- Model-aware routing
- Load balancing
- Unsupported model handling
- Streaming responses
- Service discovery
- Health checks
Usage:
cd rust/tests/integration
bash test_babysitter_integration.shThis test uses TOML config files for babysitter configuration, demonstrating the config file-based approach.
- Model Aggregation: Tests
/modelsendpoint aggregates models from all services - Model-Aware Routing: Tests routing to services supporting specific models
- Load Balancing: Tests load balancing across services supporting the same model
- Unsupported Model: Tests error handling for unsupported models
- Streaming: Tests streaming response proxying
- Service Discovery: Tests service registration and discovery
- Health Checks: Tests health check system
- Babysitter Health: Tests babysitter health endpoints
- Babysitter /models: Tests babysitter proxying /models to managed service
- Babysitter /info: Tests babysitter info endpoint
- Service Registration: Tests services registered via babysitter
- Model Aggregation: Tests
/modelsendpoint aggregates models from babysitter-managed services - Model-Aware Routing: Tests routing to services managed by babysitters
- Load Balancing: Tests load balancing across babysitter-managed services
- Unsupported Model: Tests error handling for unsupported models
- Streaming: Tests streaming response proxying through babysitter
- Service Discovery: Tests service registration and discovery via babysitter
- Ensure Python dependencies are installed (
aiohttp) - Check if port 8901 is available
- Check logs in
/tmp/registry_integration.logor/tmp/registry_babysitter_test.log
- Ensure Python dependencies are installed
- Check if ports 6001-6003 are available
- Check service logs in
/tmp/service*.log
- Ensure babysitter binary is built:
cargo build --release --bin infini-babysitter - Check babysitter logs in
/tmp/babysitter*.log - Verify config files are created correctly in
/tmp/babysitter_test_configs/ - Ensure mock service script path is correct in config files
- Ensure router binary is built:
cargo build --release --bin infini-router - Check router logs in
/tmp/router_integration.logor/tmp/router_babysitter_test.log
- Check all service logs for errors
- Ensure services have time to register and pass health checks (wait times in script)
- Verify registry is accessible at
http://127.0.0.1:8901 - For babysitter tests, verify babysitters are running and their health endpoints respond
- Check that babysitter-managed services are registered with the registry
The test script provides:
- ✅ Pass indicators for successful tests
- ❌ Fail indicators with error details
- Summary of passed/failed tests
- Exit code 0 for success, 1 for failure