-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_tests.sh
More file actions
executable file
·153 lines (127 loc) · 5.63 KB
/
Copy pathrun_tests.sh
File metadata and controls
executable file
·153 lines (127 loc) · 5.63 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
#!/bin/bash
################################################################################
# CuraLit - Quick Test Runner
# Runs all test suites with colored output
################################################################################
set -e
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
CYAN='\033[0;36m'
NC='\033[0m'
echo -e "${CYAN}╔═══════════════════════════════════════════════════════════╗${NC}"
echo -e "${CYAN}║ CuraLit Test Suite Runner ║${NC}"
echo -e "${CYAN}╚═══════════════════════════════════════════════════════════╝${NC}"
echo ""
FAILED=0
################################################################################
# Rust Unit Tests
################################################################################
echo -e "${YELLOW}Running Rust Unit Tests...${NC}\n"
if cargo test --quiet 2>&1 | grep -q "test result: ok"; then
echo -e "${GREEN}✓ All Rust unit tests passed${NC}\n"
else
echo -e "${RED}✗ Some Rust unit tests failed${NC}\n"
FAILED=1
fi
################################################################################
# Individual Test Suites
################################################################################
echo -e "${YELLOW}Running Individual Test Suites...${NC}\n"
# Article tests
echo -e "${BLUE}Running article tests...${NC}"
if cargo test --test article_test --quiet 2>&1 | grep -q "test result: ok"; then
echo -e "${GREEN}✓ Article tests passed${NC}"
else
echo -e "${RED}✗ Article tests failed${NC}"
FAILED=1
fi
# Parser tests
echo -e "${BLUE}Running parser tests...${NC}"
if cargo test --test parser_test --quiet 2>&1 | grep -q "test result: ok"; then
echo -e "${GREEN}✓ Parser tests passed${NC}"
else
echo -e "${RED}✗ Parser tests failed${NC}"
FAILED=1
fi
# Modelfile tests
echo -e "${BLUE}Running modelfile tests...${NC}"
if cargo test --test modelfile_test --quiet 2>&1 | grep -q "test result: ok"; then
echo -e "${GREEN}✓ Modelfile tests passed${NC}"
else
echo -e "${RED}✗ Modelfile tests failed${NC}"
FAILED=1
fi
# Checkpoint tests
echo -e "${BLUE}Running checkpoint tests...${NC}"
if cargo test --test checkpoint_test --quiet 2>&1 | grep -q "test result: ok"; then
echo -e "${GREEN}✓ Checkpoint tests passed${NC}"
else
echo -e "${RED}✗ Checkpoint tests failed${NC}"
FAILED=1
fi
# Database tests
echo -e "${BLUE}Running database tests...${NC}"
if cargo test --test database_test --quiet 2>&1 | grep -q "test result: ok"; then
echo -e "${GREEN}✓ Database tests passed${NC}"
else
echo -e "${RED}✗ Database tests failed${NC}"
FAILED=1
fi
echo ""
################################################################################
# Optional: Comprehensive Integration Tests
################################################################################
if [ "$1" = "--full" ] || [ "$1" = "-f" ]; then
echo -e "${YELLOW}Running Comprehensive Integration Tests...${NC}\n"
if [ -f "./tests/comprehensive_test.sh" ]; then
./tests/comprehensive_test.sh
if [ $? -ne 0 ]; then
FAILED=1
fi
else
echo -e "${RED}✗ Comprehensive test script not found${NC}"
FAILED=1
fi
fi
################################################################################
# Optional: RAG Integration Tests (requires services)
################################################################################
if [ "$1" = "--rag" ] || [ "$2" = "--rag" ]; then
echo -e "${YELLOW}Running RAG Integration Tests (requires services)...${NC}\n"
echo -e "${BLUE}Note: Requires Qdrant and Ollama running${NC}"
if cargo test --test rag_integration_test -- --ignored --quiet 2>&1 | grep -q "test result: ok"; then
echo -e "${GREEN}✓ RAG integration tests passed${NC}"
else
echo -e "${YELLOW}⚠ RAG tests skipped or failed (services may not be available)${NC}"
echo -e "${BLUE}To run RAG tests, ensure:${NC}"
echo -e "${BLUE} 1. Qdrant is running: docker run -p 6333:6333 -p 6334:6334 qdrant/qdrant${NC}"
echo -e "${BLUE} 2. Ollama is running with: ollama pull nomic-embed-text${NC}"
fi
echo ""
fi
################################################################################
# Summary
################################################################################
echo -e "${CYAN}═══════════════════════════════════════════════════════════${NC}"
if [ $FAILED -eq 0 ]; then
echo -e "${GREEN}✓ ALL TESTS PASSED!${NC}"
echo ""
echo -e "${BLUE}Test suite completed successfully.${NC}"
exit 0
else
echo -e "${RED}✗ SOME TESTS FAILED${NC}"
echo ""
echo -e "${YELLOW}Please review the output above for details.${NC}"
exit 1
fi
echo -e "${CYAN}═══════════════════════════════════════════════════════════${NC}"
echo ""
echo -e "${BLUE}Usage:${NC}"
echo -e " ${CYAN}./run_tests.sh${NC} - Run unit tests only"
echo -e " ${CYAN}./run_tests.sh --full${NC} - Run unit + integration tests"
echo -e " ${CYAN}./run_tests.sh --rag${NC} - Include RAG tests (requires services)"
echo -e " ${CYAN}./run_tests.sh --full --rag${NC} - Run all tests"
echo ""