-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_tests.sh
More file actions
executable file
·197 lines (172 loc) · 6.55 KB
/
Copy pathrun_tests.sh
File metadata and controls
executable file
·197 lines (172 loc) · 6.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
#!/bin/bash
# Script para ejecutar los tests funcionales de Neuro Agent
# Uso: ./run_tests.sh [opción]
set -e
# Colores para output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Banner
echo -e "${BLUE}"
echo "╔═══════════════════════════════════════════════════════════╗"
echo "║ 🧪 NEURO AGENT - TEST SUITE RUNNER 🧪 ║"
echo "╚═══════════════════════════════════════════════════════════╝"
echo -e "${NC}"
# Función para verificar si Ollama está corriendo
check_ollama() {
echo -e "${YELLOW}🔍 Verificando Ollama...${NC}"
if curl -s http://localhost:11434/api/tags > /dev/null 2>&1; then
echo -e "${GREEN}✅ Ollama está corriendo${NC}"
return 0
else
echo -e "${RED}❌ Ollama no está corriendo${NC}"
echo -e "${YELLOW}💡 Inicia Ollama con: ollama serve${NC}"
return 1
fi
}
# Función para verificar modelos
check_models() {
echo -e "${YELLOW}🔍 Verificando modelos...${NC}"
if ollama list | grep -q "qwen3:0.6b"; then
echo -e "${GREEN}✅ Modelo qwen3:0.6b disponible${NC}"
else
echo -e "${RED}❌ Modelo qwen3:0.6b no encontrado${NC}"
echo -e "${YELLOW}💡 Descárgalo con: ollama pull qwen3:0.6b${NC}"
fi
if ollama list | grep -q "qwen3:8b"; then
echo -e "${GREEN}✅ Modelo qwen3:8b disponible${NC}"
else
echo -e "${RED}❌ Modelo qwen3:8b no encontrado${NC}"
echo -e "${YELLOW}💡 Descárgalo con: ollama pull qwen3:8b${NC}"
fi
}
# Función para mostrar ayuda
show_help() {
echo "Uso: $0 [opción]"
echo ""
echo "Opciones:"
echo " all - Ejecutar TODOS los tests (requiere Ollama)"
echo " fast - Solo tests rápidos (sin Ollama)"
echo " functional - Tests funcionales completos (requiere Ollama)"
echo " tools - Tests de herramientas"
echo " classification - Tests de clasificación y routing"
echo " chat - Test de chat conversacional"
echo " arithmetic - Test de operaciones aritméticas"
echo " code - Test de generación de código"
echo " context - Test de comprensión de contexto"
echo " integration - Test de integración completa"
echo " check - Verificar requisitos (Ollama y modelos)"
echo " help - Mostrar esta ayuda"
echo ""
echo "Ejemplos:"
echo " $0 fast # Tests rápidos sin Ollama"
echo " $0 functional # Todos los tests funcionales"
echo " $0 chat # Solo test de chat"
echo " $0 check # Verificar configuración"
}
# Procesar argumentos
case "${1:-help}" in
all)
echo -e "${BLUE}🚀 Ejecutando TODOS los tests...${NC}"
check_ollama || exit 1
echo ""
cargo test --verbose
cargo test --test functional_tests -- --ignored --nocapture
;;
fast)
echo -e "${BLUE}⚡ Ejecutando tests rápidos (sin Ollama)...${NC}"
echo ""
cargo test --test tool_tests
cargo test --test classification_tests
;;
functional)
echo -e "${BLUE}🧪 Ejecutando tests funcionales completos...${NC}"
check_ollama || exit 1
echo ""
cargo test --test functional_tests -- --ignored --nocapture --test-threads=1
;;
tools)
echo -e "${BLUE}🔧 Ejecutando tests de herramientas...${NC}"
echo ""
cargo test --test tool_tests -- --nocapture
;;
classification)
echo -e "${BLUE}📊 Ejecutando tests de clasificación...${NC}"
echo ""
cargo test --test classification_tests -- --nocapture
;;
chat)
echo -e "${BLUE}💬 Ejecutando test de chat...${NC}"
check_ollama || exit 1
echo ""
cargo test --test functional_tests test_simple_chat -- --ignored --nocapture
;;
arithmetic)
echo -e "${BLUE}🧮 Ejecutando test de aritmética...${NC}"
check_ollama || exit 1
echo ""
cargo test --test functional_tests test_arithmetic_operations -- --ignored --nocapture
;;
code)
echo -e "${BLUE}💻 Ejecutando test de generación de código...${NC}"
check_ollama || exit 1
echo ""
cargo test --test functional_tests test_code_generation -- --ignored --nocapture
;;
context)
echo -e "${BLUE}🧠 Ejecutando test de comprensión de contexto...${NC}"
check_ollama || exit 1
echo ""
cargo test --test functional_tests test_context_comprehension -- --ignored --nocapture
;;
integration)
echo -e "${BLUE}🔄 Ejecutando test de integración completa...${NC}"
check_ollama || exit 1
echo ""
cargo test --test functional_tests test_full_integration_scenario -- --ignored --nocapture
;;
check)
echo -e "${BLUE}🔍 Verificando requisitos...${NC}"
echo ""
# Verificar Rust
if command -v cargo &> /dev/null; then
echo -e "${GREEN}✅ Cargo instalado:${NC} $(cargo --version)"
else
echo -e "${RED}❌ Cargo no encontrado${NC}"
fi
# Verificar Ollama
if command -v ollama &> /dev/null; then
echo -e "${GREEN}✅ Ollama instalado:${NC} $(ollama --version 2>/dev/null || echo 'version desconocida')"
check_ollama
check_models
else
echo -e "${RED}❌ Ollama no instalado${NC}"
echo -e "${YELLOW}💡 Instala desde: https://ollama.ai${NC}"
fi
# Verificar estructura de tests
echo ""
echo -e "${YELLOW}📂 Estructura de tests:${NC}"
if [ -f "tests/functional_tests.rs" ]; then
echo -e "${GREEN}✅ tests/functional_tests.rs${NC}"
fi
if [ -f "tests/tool_tests.rs" ]; then
echo -e "${GREEN}✅ tests/tool_tests.rs${NC}"
fi
if [ -f "tests/classification_tests.rs" ]; then
echo -e "${GREEN}✅ tests/classification_tests.rs${NC}"
fi
;;
help|--help|-h)
show_help
;;
*)
echo -e "${RED}❌ Opción desconocida: $1${NC}"
echo ""
show_help
exit 1
;;
esac
echo ""
echo -e "${GREEN}✨ Completado!${NC}"