A comprehensive test suite for Kolosal Server that provides extensive testing capabilities for LLM completions, embeddings, document processing, and RAG functionality.
This test suite now uses YAML-based configuration for better maintainability and alignment with Kolosal Server's configuration format:
config/config.yaml
- Main server and model configurationconfig/agents.yaml
- Agent system configurationconfig/sequential_workflows.yaml
- Workflow definitions
β Fully backwards compatible - existing code continues to work!
π See YAML_MIGRATION_GUIDE.md for detailed migration information.
π§ͺ Test the configuration: python test_yaml_config.py
- Python 3.7 or higher
- A running instance of Kolosal Server
- Access to the server's API endpoints (configured in
config/config.yaml
)
-
Clone the repository:
git clone <repository-url> cd kolosal-server-test
-
Install dependencies:
# Using uv (recommended) uv pip install -r requirements.txt # Or using pip with virtual environment python -m venv venv venv\Scripts\activate # On Windows pip install -r requirements.txt # Install PyYAML for configuration pip install PyYAML
# Test YAML configuration
python test_yaml_config.py
# Test server connectivity
python basic_test.py
# Run full test suite
python main.py
# Run specific test categories
python scripts/launcher.py --test-endpoints
python scripts/launcher.py --run-tests
- π€ LLM Completion Testing: Basic and streaming completion endpoints
- π’ Embedding Generation: Text embedding capabilities testing
- π Document Processing: PDF and DOCX parsing functionality
- π Document Management: Ingestion and retrieval testing
- π Vector Search: Document search and retrieval capabilities
- π RAG Features: Retrieval Augmented Generation testing
- β‘ Concurrent Operations: Performance testing under load
- π οΈ Agent System: Workflow and agent functionality testing
- π Comprehensive Logging: Detailed request/response tracking
- β‘ Performance Metrics: Response time and throughput analysis
- π Endpoint Discovery: Automatic endpoint availability testing
- π‘οΈ Error Handling: Robust error detection and reporting
- π Test Reporting: Detailed success/failure analytics
kolosal-server-test/
βββ main.py # Main test runner with comprehensive reporting
βββ config.py # Centralized configuration management
βββ logging_utils.py # Enhanced logging and request tracking
βββ quick_start_demo.py # Interactive API demo
βββ run_api_tests.py # Reference API test runner
βββ requirements.txt # Python dependencies
βββ scripts/ # Launcher and utility scripts
β βββ launcher.py # Enhanced test launcher with validation
β βββ launch_all.bat # Windows batch launcher
β βββ launch_tests.ps1 # PowerShell launcher
β βββ kill_test.bat # Stop all test processes
βββ utils/ # Utility modules
β βββ endpoint_tester.py # Comprehensive endpoint testing
β βββ demo_enhanced_logging.py # Logging demonstration
β βββ fix_id_extractions.py # ID extraction utilities
βββ tests/ # Test modules organized by category
β βββ engine_tests/ # LLM and embedding tests
β β βββ completion_test.py
β β βββ embedding_test.py
β βββ retrieval_tests/ # Document processing tests
β β βββ parse_pdf_test.py
β β βββ parse_docx_test.py
β β βββ document_ingestion_test.py
β β βββ document_retrieval_test.py
β βββ agent_tests/ # Agent and RAG tests
β βββ test_agent_features.py
β βββ test_rag_features.py
β βββ test_workflows.py
βββ test_files/ # Sample test documents
βββ logs/ # Test execution logs
βββ backup/ # Backup of original documentation
The test suite is configured to work with Kolosal Server's actual deployment settings:
# Server settings (config.py)
SERVER_CONFIG = {
"base_url": "http://127.0.0.1:8080", # Default server URL
"api_key": None, # No API key required
"rate_limit": {
"max_requests": 100, # Rate limiting
"window_seconds": 60
}
}
Configured for standard Kolosal Server models:
- Primary LLM:
qwen3-0.6b
- Alternative LLM:
gpt-3.5-turbo
- Embeddings:
text-embedding-3-small
,text-embedding-3-large
All 25+ server endpoints are mapped and tested:
- Health:
/health
- Models:
/models
,/engines
- OpenAI Compatible:
/v1/chat/completions
,/v1/embeddings
- Document Processing:
/parse-pdf
,/parse-docx
- Vector Search:
/vector-search
- Workflows:
/sequential-workflows
- Agent System:
/agents/*
- Metrics:
/metrics
python basic_test.py
Verifies server accessibility and basic functionality.
python utils/endpoint_tester.py
Tests all 25+ endpoints for availability and response.
python main.py
Runs the complete test suite with detailed reporting:
- LLM completion tests (basic and streaming)
- Embedding generation tests
- PDF and DOCX parsing tests
- Document ingestion and retrieval tests
- Agent system tests
- RAG feature tests
- Workflow tests
- Reference API tests
# Test with prerequisites checking
python scripts/launcher.py --run-tests
# Test endpoints only
python scripts/launcher.py --test-endpoints
# Windows PowerShell
.\scripts\launch_tests.ps1 -RunTests
python quick_start_demo.py
Interactive demo following the API guide examples.
- Completion Test: Basic and streaming LLM completions
- Embedding Test: Text embedding generation and validation
- PDF Parsing: Extract text and metadata from PDF files
- DOCX Parsing: Process Word documents
- Document Ingestion: Add documents to knowledge base
- Document Retrieval: Search and retrieve documents
- Agent Features: Agent creation and management
- RAG Features: Retrieval Augmented Generation
- Workflows: Multi-step workflow execution
The test suite includes comprehensive endpoint logging that tracks:
- HTTP methods and URLs
- Complete JSON payloads
- Request size and timing
- Headers and parameters
- HTTP status codes
- Response JSON data
- Response size and headers
- Success/failure status
- Request duration
- Requests per second
- Performance trending
- Bottleneck identification
- Console: Real-time formatted output with β /β indicators
- File Logs:
logs/endpoint_tests.log
- Structured JSON data - Test Logs:
tests.log
- Complete test execution log
Example log output:
[β
PASS] Document Upload - POST /api/v1/documents | Request: 1024B | Response: 200 (256B) | Duration: 0.123s
π€ Request Payload: {"documents": [...], "collection_name": "test_collection"}
π₯ Response Data: {"success": true, "indexed_count": 3}
- Before: Mixed error handling patterns, crashes on assertions
- After: Standardized try-catch blocks with proper logging
- Before: Poor response validation, unclear failure reasons
- After: Proper response structure validation and detailed error reporting
- Before: Inconsistent API endpoint formats
- After: Aligned with actual Kolosal Server API endpoints
- Before: Tests failed on missing files
- After: Graceful fallback to minimal content when test files unavailable
- Before: Inconsistent logging across tests
- After: Standardized logging with clear PASS/FAIL indicators
- PDF Parsing:
/parse_pdf
β/parse-pdf
- DOCX Parsing:
/parse_docx
β/parse-docx
- Document Retrieval:
/retrieve
β/vector-search
- Embeddings:
/embeddings
β/v1/embeddings
- Chat:
/chat
β/v1/chat/completions
# Test basic connectivity
python basic_test.py
# Check if server is running
curl http://127.0.0.1:8080/health
- PDF and DOCX tests include fallback content
- Files automatically created if missing
- Check
test_files/
directory for sample files
- No API key required for default configuration
- Set
api_key=None
in config.py - Server configured with "API Key Required: No"
- Default: 100 requests per 60 seconds
- Tests include automatic rate limiting handling
- Configurable in
config.py
Failed to format chat templates: Unknown method: startswith
Resolution: Fix Jinja2 template syntax in server configuration
JSON parsing error: incomplete UTF-8 string
Resolution: Server-side JSON parsing improvement needed
- Request/response timing
- Success/failure rates
- Error categorization
- Performance trending
- Resource utilization
Tests provide detailed performance insights:
- Average response times per endpoint
- Requests per second calculations
- Error rate analysis
- Performance recommendations
- Create test file in appropriate directory (
tests/
) - Inherit from
KolosalTestBase
for logging integration - Use
make_tracked_request()
for automatic logging - Follow standardized error handling patterns
- Modify
config.py
for server/model settings - Update endpoint mappings as needed
- Adjust rate limiting and timeouts
- Use
EndpointLogger
for custom request tracking - Implement
RequestTracker
context manager - Add custom metadata fields as needed
- β API Fixes Applied: Standardized error handling and response validation
- β Configuration Alignment: Updated to match actual server deployment
- β Enhanced Logging: Comprehensive request/response tracking
- β Endpoint Fixes: Corrected all endpoint URLs to match server implementation
- β Documentation Consolidation: Merged all documentation into single README
- β Test Reliability: Added fallback mechanisms and robust error handling
- β Performance Monitoring: Detailed metrics and analysis capabilities
- All configuration centralized in
config.py
- Logging enhanced with detailed request tracking
- Test files reorganized by category
- Endpoint URLs updated to match server implementation
- Error handling standardized across all tests
- Follow existing code patterns and error handling
- Use the centralized configuration system
- Include comprehensive logging for new endpoints
- Add appropriate test categories and documentation
- Ensure backward compatibility with existing tests
This project is part of the Kolosal Server ecosystem. Please refer to the main project for licensing information.
Note: This test suite has been restructured and enhanced to align with the actual Kolosal Server deployment. All previous documentation has been consolidated into this comprehensive README for easier maintenance and reference.