- Update all submodule URLs from gitea.centraal.wbd-rd.nl to gitea.wbd-rd.nl - Add settler as proper submodule in .gitmodules - Add agent skills, function anchors, decisions, and improvements - Add Docker configuration and scripts - Add manuals and third_party docs - Update .gitignore with secrets and build artifacts - Remove stale .tgz build artifact Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
175 lines
5.5 KiB
Bash
175 lines
5.5 KiB
Bash
#!/bin/sh
|
|
# =============================================================
|
|
# EVOLV Unified Test Runner
|
|
# Usage: test-all.sh [tier] [node-name]
|
|
# tier: all (default), basic, integration, edge, gf
|
|
# node-name: optional filter for a specific node
|
|
# =============================================================
|
|
set -e
|
|
|
|
EVOLV_DIR="${EVOLV_DIR:-/data/evolv}"
|
|
TIER="${1:-all}"
|
|
NODE_FILTER="${2:-}"
|
|
|
|
# Colors
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[0;33m'
|
|
CYAN='\033[0;36m'
|
|
NC='\033[0m' # No Color
|
|
|
|
PASS_COUNT=0
|
|
FAIL_COUNT=0
|
|
SKIP_COUNT=0
|
|
FAILED_TESTS=""
|
|
|
|
# ---------------------------------------------------------
|
|
# Run tests for a given directory pattern
|
|
# ---------------------------------------------------------
|
|
run_tests() {
|
|
local node_name="$1"
|
|
local tier="$2"
|
|
local test_dir="$EVOLV_DIR/nodes/$node_name/test/$tier"
|
|
|
|
if [ ! -d "$test_dir" ]; then
|
|
printf "${YELLOW}SKIP${NC} %s/%s (no test dir)\n" "$node_name" "$tier"
|
|
SKIP_COUNT=$((SKIP_COUNT + 1))
|
|
return 0
|
|
fi
|
|
|
|
# Find test files
|
|
test_files=$(find "$test_dir" -name "*.test.js" -type f 2>/dev/null | sort)
|
|
if [ -z "$test_files" ]; then
|
|
printf "${YELLOW}SKIP${NC} %s/%s (no test files)\n" "$node_name" "$tier"
|
|
SKIP_COUNT=$((SKIP_COUNT + 1))
|
|
return 0
|
|
fi
|
|
|
|
for test_file in $test_files; do
|
|
local basename=$(basename "$test_file")
|
|
printf "${CYAN}RUN ${NC} %s/%s/%s ... " "$node_name" "$tier" "$basename"
|
|
|
|
if node --test "$test_file" > /tmp/test_output_$$ 2>&1; then
|
|
printf "${GREEN}PASS${NC}\n"
|
|
PASS_COUNT=$((PASS_COUNT + 1))
|
|
else
|
|
printf "${RED}FAIL${NC}\n"
|
|
FAIL_COUNT=$((FAIL_COUNT + 1))
|
|
FAILED_TESTS="$FAILED_TESTS\n - $node_name/$tier/$basename"
|
|
# Show failure details (last 20 lines)
|
|
tail -20 /tmp/test_output_$$ | sed 's/^/ /'
|
|
fi
|
|
rm -f /tmp/test_output_$$
|
|
done
|
|
}
|
|
|
|
# ---------------------------------------------------------
|
|
# generalFunctions tests
|
|
# ---------------------------------------------------------
|
|
run_gf_tests() {
|
|
local gf_test_dir="$EVOLV_DIR/nodes/generalFunctions/test"
|
|
if [ ! -d "$gf_test_dir" ]; then
|
|
printf "${YELLOW}SKIP${NC} generalFunctions (no test dir)\n"
|
|
SKIP_COUNT=$((SKIP_COUNT + 1))
|
|
return 0
|
|
fi
|
|
|
|
# Find all test files recursively in generalFunctions
|
|
test_files=$(find "$gf_test_dir" -name "*.test.js" -type f 2>/dev/null | sort)
|
|
if [ -z "$test_files" ]; then
|
|
printf "${YELLOW}SKIP${NC} generalFunctions (no test files)\n"
|
|
SKIP_COUNT=$((SKIP_COUNT + 1))
|
|
return 0
|
|
fi
|
|
|
|
for test_file in $test_files; do
|
|
local relpath=$(echo "$test_file" | sed "s|$gf_test_dir/||")
|
|
printf "${CYAN}RUN ${NC} generalFunctions/%s ... " "$relpath"
|
|
|
|
if node --test "$test_file" > /tmp/test_output_$$ 2>&1; then
|
|
printf "${GREEN}PASS${NC}\n"
|
|
PASS_COUNT=$((PASS_COUNT + 1))
|
|
else
|
|
printf "${RED}FAIL${NC}\n"
|
|
FAIL_COUNT=$((FAIL_COUNT + 1))
|
|
FAILED_TESTS="$FAILED_TESTS\n - generalFunctions/$relpath"
|
|
tail -20 /tmp/test_output_$$ | sed 's/^/ /'
|
|
fi
|
|
rm -f /tmp/test_output_$$
|
|
done
|
|
}
|
|
|
|
# ---------------------------------------------------------
|
|
# Determine which tiers to run
|
|
# ---------------------------------------------------------
|
|
case "$TIER" in
|
|
basic|integration|edge)
|
|
TIERS="$TIER"
|
|
;;
|
|
gf)
|
|
TIERS=""
|
|
;;
|
|
all)
|
|
TIERS="basic integration edge"
|
|
;;
|
|
*)
|
|
echo "Usage: test-all.sh [all|basic|integration|edge|gf] [node-name]"
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
echo "=============================================="
|
|
echo " EVOLV Test Runner"
|
|
echo " Tier: $TIER | Node filter: ${NODE_FILTER:-all}"
|
|
echo "=============================================="
|
|
echo ""
|
|
|
|
# ---------------------------------------------------------
|
|
# Run generalFunctions tests if tier is 'all' or 'gf'
|
|
# ---------------------------------------------------------
|
|
if [ "$TIER" = "all" ] || [ "$TIER" = "gf" ]; then
|
|
if [ -z "$NODE_FILTER" ] || [ "$NODE_FILTER" = "generalFunctions" ]; then
|
|
run_gf_tests
|
|
fi
|
|
fi
|
|
|
|
# ---------------------------------------------------------
|
|
# Discover and run node tests
|
|
# ---------------------------------------------------------
|
|
if [ -n "$TIERS" ]; then
|
|
# Get list of nodes (directories under nodes/ that have a test/ subdirectory)
|
|
NODES=$(find "$EVOLV_DIR/nodes" -maxdepth 2 -name "test" -type d | \
|
|
sed "s|$EVOLV_DIR/nodes/||" | sed 's|/test||' | \
|
|
grep -v "generalFunctions" | sort)
|
|
|
|
for node in $NODES; do
|
|
# Apply node filter if specified
|
|
if [ -n "$NODE_FILTER" ] && [ "$node" != "$NODE_FILTER" ]; then
|
|
continue
|
|
fi
|
|
|
|
for tier in $TIERS; do
|
|
run_tests "$node" "$tier"
|
|
done
|
|
done
|
|
fi
|
|
|
|
# ---------------------------------------------------------
|
|
# Summary
|
|
# ---------------------------------------------------------
|
|
echo ""
|
|
echo "=============================================="
|
|
TOTAL=$((PASS_COUNT + FAIL_COUNT + SKIP_COUNT))
|
|
printf " Results: ${GREEN}%d passed${NC}, ${RED}%d failed${NC}, ${YELLOW}%d skipped${NC} (%d total)\n" \
|
|
"$PASS_COUNT" "$FAIL_COUNT" "$SKIP_COUNT" "$TOTAL"
|
|
|
|
if [ $FAIL_COUNT -gt 0 ]; then
|
|
printf "\n ${RED}Failed tests:${NC}"
|
|
printf "$FAILED_TESTS\n"
|
|
echo "=============================================="
|
|
exit 1
|
|
fi
|
|
|
|
echo "=============================================="
|
|
exit 0
|