|
173 | 173 | # ── Colors ──────────────────────────────────────────────────────────────────── |
174 | 174 | RED='\033[0;31m'; GREEN='\033[0;32m'; YELLOW='\033[1;33m' |
175 | 175 | CYAN='\033[0;36m'; NC='\033[0m' |
176 | | - |
177 | | -pass() { echo -e "${GREEN}[PASS]${NC} $1"; ((PASS++)); } |
178 | | -fail() { echo -e "${RED}[FAIL]${NC} $1"; ((FAIL++)); } |
179 | | -info() { echo -e "${CYAN}[INFO]${NC} $1"; } |
180 | | -warn() { echo -e "${YELLOW}[WARN]${NC} $1"; } |
181 | | - |
182 | | -echo -e "${CYAN}======================================${NC}" |
183 | | -echo -e "${CYAN} Lab ${LAB_ID}: ${LAB_NAME}${NC}" |
184 | | -echo -e "${CYAN} Module: ${MODULE}${NC}" |
185 | | -echo -e "${CYAN}======================================${NC}" |
186 | | -echo "" |
187 | | - |
188 | | -# ── PHASE 1: Setup ──────────────────────────────────────────────────────────── |
189 | | -info "Phase 1: Setup" |
190 | | -docker compose -f "${COMPOSE_FILE}" up -d |
191 | | -info "Waiting 30s for ${MODULE} to initialize..." |
192 | | -sleep 30 |
193 | | - |
194 | | -# ── PHASE 2: Health Checks ──────────────────────────────────────────────────── |
195 | | -info "Phase 2: Health Checks" |
196 | | - |
197 | | -if docker compose -f "${COMPOSE_FILE}" ps | grep -q "running\|Up"; then |
198 | | - pass "Container is running" |
199 | | -else |
200 | | - fail "Container is not running" |
201 | | -fi |
202 | | - |
203 | | -# ── PHASE 3: Functional Tests ───────────────────────────────────────────────── |
204 | | -info "Phase 3: Functional Tests (Lab 03 — Advanced Features)" |
205 | | - |
206 | | -# TODO: Add module-specific functional tests here |
207 | | -# Example: |
208 | | -# if curl -sf http://localhost:9000/health > /dev/null 2>&1; then |
209 | | -# pass "Health endpoint responds" |
210 | | -# else |
211 | | -# fail "Health endpoint not reachable" |
212 | | -# fi |
213 | | - |
214 | | -warn "Functional tests for Lab 20-03 pending implementation" |
215 | | - |
216 | | -# ── PHASE 4: Cleanup ────────────────────────────────────────────────────────── |
217 | | -info "Phase 4: Cleanup" |
218 | | -docker compose -f "${COMPOSE_FILE}" down -v --remove-orphans |
219 | | -info "Cleanup complete" |
220 | | - |
221 | | -# ── Results ─────────────────────────────────────────────────────────────────── |
222 | | -echo "" |
223 | | -echo -e "${CYAN}======================================${NC}" |
224 | | -echo -e " Lab ${LAB_ID} Complete" |
225 | | -echo -e " ${GREEN}PASS: ${PASS}${NC} | ${RED}FAIL: ${FAIL}${NC}" |
226 | | -echo -e "${CYAN}======================================${NC}" |
227 | | - |
228 | | -if [ "${FAIL}" -gt 0 ]; then |
229 | | - exit 1 |
230 | | -fi |
0 commit comments