#!/bin/bash # Run all tests for Atlas voice agent system set -e # Exit on error echo "╔══════════════════════════════════════════════════════════════╗" echo "║ Atlas Voice Agent - Test Suite ║" echo "╚══════════════════════════════════════════════════════════════╝" echo "" BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" cd "$BASE_DIR" # Colors GREEN='\033[0;32m' RED='\033[0;31m' YELLOW='\033[1;33m' NC='\033[0m' # No Color PASSED=0 FAILED=0 test_command() { local name="$1" local cmd="$2" echo -n "Testing $name... " if eval "$cmd" > /dev/null 2>&1; then echo -e "${GREEN}✅ PASSED${NC}" ((PASSED++)) return 0 else echo -e "${RED}❌ FAILED${NC}" ((FAILED++)) return 1 fi } # Check prerequisites echo "📋 Checking prerequisites..." echo "" # Check Python if ! command -v python3 &> /dev/null; then echo -e "${RED}❌ Python3 not found${NC}" exit 1 fi # Check Ollama (if local) if grep -q "OLLAMA_HOST=localhost" .env 2>/dev/null; then if ! curl -s http://localhost:11434/api/tags > /dev/null 2>&1; then echo -e "${YELLOW}⚠️ Ollama not running on localhost:11434${NC}" echo " Start with: ollama serve" fi fi echo "" echo "🧪 Running tests..." echo "" # Test 1: MCP Server Tools if [ -f "mcp-server/test_mcp.py" ]; then test_command "MCP Server Tools" "cd mcp-server && python3 -c 'from tools.registry import ToolRegistry; r = ToolRegistry(); assert len(r.list_tools()) == 22'" fi # Test 2: LLM Connection if [ -f "llm-servers/4080/test_connection.py" ]; then test_command "LLM Connection" "cd llm-servers/4080 && python3 test_connection.py | grep -q 'Chat test successful'" fi # Test 3: Router if [ -f "routing/test_router.py" ]; then test_command "LLM Router" "cd routing && python3 test_router.py" fi # Test 4: Memory System if [ -f "memory/test_memory.py" ]; then test_command "Memory System" "cd memory && python3 test_memory.py" fi # Test 5: Monitoring if [ -f "monitoring/test_monitoring.py" ]; then test_command "Monitoring" "cd monitoring && python3 test_monitoring.py" fi # Test 6: Safety Boundaries if [ -f "safety/boundaries/test_boundaries.py" ]; then test_command "Safety Boundaries" "cd safety/boundaries && python3 test_boundaries.py" fi # Test 7: Confirmations if [ -f "safety/confirmations/test_confirmations.py" ]; then test_command "Confirmations" "cd safety/confirmations && python3 test_confirmations.py" fi # Test 8: Conversation if [ -f "conversation/test_session.py" ]; then test_command "Conversation Management" "cd conversation && python3 test_session.py" fi # Test 9: Summarization if [ -f "conversation/summarization/test_summarization.py" ]; then test_command "Conversation Summarization" "cd conversation/summarization && python3 test_summarization.py" fi # Test 10: MCP Adapter (requires server running) if [ -f "mcp-adapter/test_adapter.py" ]; then if curl -s http://localhost:8000/health > /dev/null 2>&1; then test_command "MCP Adapter" "cd mcp-adapter && python3 test_adapter.py" else echo -e "${YELLOW}⚠️ MCP Adapter test skipped (server not running)${NC}" fi fi # Summary echo "" echo "╔══════════════════════════════════════════════════════════════╗" echo "║ Test Results ║" echo "╚══════════════════════════════════════════════════════════════╝" echo "" echo -e "${GREEN}✅ Passed: $PASSED${NC}" if [ $FAILED -gt 0 ]; then echo -e "${RED}❌ Failed: $FAILED${NC}" else echo -e "${GREEN}❌ Failed: $FAILED${NC}" fi echo "" if [ $FAILED -eq 0 ]; then echo -e "${GREEN}🎉 All tests passed!${NC}" exit 0 else echo -e "${RED}⚠️ Some tests failed. Check output above.${NC}" exit 1 fi