prole/tests/test_all_prole_home_fixes.sh
chrisfu fff18fdbe4 Update Prole-DB and improve Supabase integration
- Bumped Prole-DB image version to 17.7-053 in scripts, Dockerfile, and manifests.
- Replaced `prole-scan` with `prole-agent` throughout scripts and tests.
- Refined Kubernetes setup for Supabase to use namespace 'supabase'.
- Introduced conversion of Supabase Docker Compose to Kubernetes manifests with `kompose`.
- Added support for Kerberos toggle via environment variables in `init_kerberos.sh`.
- Improved error handling and logging in scripts for better maintainability.
2026-02-01 23:56:25 -08:00

95 lines
3.4 KiB
Bash
Executable File

#!/bin/bash
echo "=============================================="
echo " Comprehensive .prole Directory Tests"
echo "=============================================="
echo ""
TESTS_PASSED=0
TESTS_TOTAL=0
test_item() {
TESTS_TOTAL=$((TESTS_TOTAL + 1))
echo -n "[$TESTS_TOTAL] $1... "
shift
if "$@" > /dev/null 2>&1; then
echo "✓"
TESTS_PASSED=$((TESTS_PASSED + 1))
return 0
else
echo "✗"
return 1
fi
}
echo "DIRECTORY STRUCTURE"
test_item "Create .prole directory" python3 -c "from pathlib import Path; (Path.home() / '.prole').mkdir(exist_ok=True)"
test_item "Create build directory" python3 -c "from pathlib import Path; (Path.home() / '.prole' / 'build').mkdir(parents=True, exist_ok=True)"
test_item "Create scan directory" python3 -c "from pathlib import Path; (Path.home() / '.prole' / 'scan').mkdir(parents=True, exist_ok=True)"
echo ""
echo "DOCKER BUILD FIX"
test_item "prole-db directory exists" test -d prole-db
test_item "Dockerfile exists" test -f prole-db/Dockerfile
test_item "Build directory creation" python3 -c "from pathlib import Path; d = Path.home() / '.prole' / 'build' / 'prole-db'; d.mkdir(parents=True, exist_ok=True); assert d.exists()"
test_item "Build directory writable" python3 -c "from pathlib import Path; f = Path.home() / '.prole' / 'build' / 'test.txt'; f.write_text('test'); f.unlink()"
echo ""
echo "NETWORK SCAN FIX"
test_item "prole-agent binary exists" test -x prole-net/prole-agent
test_item "Scan directory creation" python3 -c "from pathlib import Path; d = Path.home() / '.prole' / 'scan'; d.mkdir(parents=True, exist_ok=True); assert d.exists()"
test_item "Scan directory writable" python3 -c "from pathlib import Path; f = Path.home() / '.prole' / 'scan' / 'test.txt'; f.write_text('test'); f.unlink()"
echo ""
echo "CODE VERIFICATION"
test_item "Build uses .prole/build" grep -q "prole_home / \"build\"" install.py
test_item "Scan uses .prole/scan" grep -q "prole_home / \"scan\"" install.py
test_item "Docker build copies context" grep -q "shutil.copytree(source_dir, build_dir)" install.py
test_item "Scan runs with cwd" grep -q "cwd=str(scan_dir)" install.py
echo ""
echo "SPEC FILE VERIFICATION"
python3 scripts/generate_spec.py > /dev/null 2>&1
test_item "Spec includes prole-db" grep -q "prole-db" installer.spec
test_item "Spec includes prole-agent" grep -q "prole-agent" installer.spec
# Cleanup
echo ""
echo "CLEANUP"
python3 << 'PYTEST'
from pathlib import Path
import shutil
prole_home = Path.home() / ".prole"
if prole_home.exists():
shutil.rmtree(prole_home)
print(" ✓ Cleaned up test directories")
PYTEST
echo ""
echo "=============================================="
echo " RESULTS: $TESTS_PASSED/$TESTS_TOTAL PASSED"
echo "=============================================="
echo ""
if [ $TESTS_PASSED -eq $TESTS_TOTAL ]; then
echo "✓✓✓ ALL PROLE HOME TESTS PASSED ✓✓✓"
echo ""
echo "FIXES IMPLEMENTED:"
echo " ✓ Docker build uses ~/.prole/build/prole-db/"
echo " ✓ Network scan uses ~/.prole/scan/"
echo " ✓ Both work from read-only PyInstaller bundle"
echo ""
echo "DIRECTORY STRUCTURE:"
echo " ~/.prole/"
echo " ├── build/"
echo " │ └── prole-db/ (Docker build context)"
echo " └── scan/ (Network scan working dir)"
echo ""
echo "DISK USAGE: ~2-6 MB total"
echo ""
exit 0
else
echo "✗ SOME TESTS FAILED"
exit 1
fi