78 lines
2.5 KiB
Bash
Executable File
78 lines
2.5 KiB
Bash
Executable File
#!/bin/bash
|
|
# test_backend_pyproject.sh - Verify backend/pyproject.toml and dependencies
|
|
# RED: Run before changes (should fail)
|
|
# GREEN: Run after changes (should pass)
|
|
|
|
REPO=/home/ken/workspace/research-workbench
|
|
BACKEND=$REPO/backend
|
|
PASS=0
|
|
FAIL=0
|
|
|
|
check_file() {
|
|
if [ -f "$1" ]; then
|
|
echo "PASS: file '$1' exists"
|
|
((PASS++))
|
|
else
|
|
echo "FAIL: file '$1' should exist but is missing"
|
|
((FAIL++))
|
|
fi
|
|
}
|
|
|
|
check_contains() {
|
|
local file="$1"
|
|
local pattern="$2"
|
|
local label="$3"
|
|
if grep -q "$pattern" "$file" 2>/dev/null; then
|
|
echo "PASS: pyproject.toml contains $label"
|
|
((PASS++))
|
|
else
|
|
echo "FAIL: pyproject.toml missing $label"
|
|
((FAIL++))
|
|
fi
|
|
}
|
|
|
|
check_import() {
|
|
local output
|
|
local exit_code
|
|
output=$(cd "$BACKEND" && uv run python -c "from ag_ui.core import RunAgentInput, EventType; print('ag-ui-protocol OK')" 2>&1)
|
|
exit_code=$?
|
|
if [ $exit_code -eq 0 ] && echo "$output" | grep -qx "ag-ui-protocol OK"; then
|
|
echo "PASS: ag-ui-protocol importable — output: $output"
|
|
((PASS++))
|
|
else
|
|
echo "FAIL: ag-ui-protocol import failed (exit=$exit_code) — got: $output"
|
|
((FAIL++))
|
|
fi
|
|
}
|
|
|
|
echo "=== Checking backend/pyproject.toml exists ==="
|
|
check_file "$BACKEND/pyproject.toml"
|
|
|
|
echo ""
|
|
echo "=== Checking pyproject.toml contents ==="
|
|
check_contains "$BACKEND/pyproject.toml" 'name = "research-workbench"' "name"
|
|
check_contains "$BACKEND/pyproject.toml" 'version = "0.1.0"' "version"
|
|
check_contains "$BACKEND/pyproject.toml" 'description = "AI research workbench backend' "description"
|
|
check_contains "$BACKEND/pyproject.toml" 'requires-python = ">=3.13"' "requires-python"
|
|
check_contains "$BACKEND/pyproject.toml" 'fastapi>=0.115.0' "fastapi dependency"
|
|
check_contains "$BACKEND/pyproject.toml" 'uvicorn\[standard\]>=0.34.0' "uvicorn dependency"
|
|
check_contains "$BACKEND/pyproject.toml" 'httpx>=0.28.0' "httpx dependency"
|
|
check_contains "$BACKEND/pyproject.toml" 'bcrypt>=4.2.0' "bcrypt dependency"
|
|
check_contains "$BACKEND/pyproject.toml" 'python-multipart>=0.0.18' "python-multipart dependency"
|
|
check_contains "$BACKEND/pyproject.toml" 'ag-ui-protocol>=0.1.18' "ag-ui-protocol dependency"
|
|
|
|
echo ""
|
|
echo "=== Checking uv.lock exists ==="
|
|
check_file "$BACKEND/uv.lock"
|
|
|
|
echo ""
|
|
echo "=== Checking ag-ui-protocol importable ==="
|
|
check_import
|
|
|
|
echo ""
|
|
echo "=============================="
|
|
echo "Results: $PASS passed, $FAIL failed"
|
|
echo "=============================="
|
|
|
|
[ $FAIL -eq 0 ] && exit 0 || exit 1
|