prole/tests/test_network_scan_fix.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

90 lines
2.5 KiB
Bash
Executable File

#!/bin/bash
echo "========================================"
echo " Network Scan Fix Verification"
echo "========================================"
echo ""
# Test 1: Scan directory creation
echo "1. Testing scan directory creation..."
python3 << 'PYTEST'
from pathlib import Path
prole_home = Path.home() / ".prole"
scan_dir = prole_home / "scan"
scan_dir.mkdir(parents=True, exist_ok=True)
if scan_dir.exists() and scan_dir.is_dir():
print(" ✓ Scan directory created")
else:
print(" ✗ Failed to create scan directory")
exit(1)
PYTEST
if [ $? -ne 0 ]; then exit 1; fi
# Test 2: Scan directory is writable
echo "2. Testing scan directory is writable..."
python3 << 'PYTEST'
from pathlib import Path
scan_dir = Path.home() / ".prole" / "scan"
test_file = scan_dir / "test.txt"
try:
test_file.write_text("test")
test_file.unlink()
print(" ✓ Scan directory is writable")
except Exception as e:
print(f" ✗ Scan directory not writable: {e}")
exit(1)
PYTEST
if [ $? -ne 0 ]; then exit 1; fi
# Test 3: prole-agent binary exists
echo "3. Testing prole-agent binary..."
if [ -x "prole-net/prole-agent" ]; then
echo " ✓ prole-agent binary exists and is executable"
else
echo " ✗ prole-agent binary missing or not executable"
exit 1
fi
# Test 4: prole-agent can run from scan directory
echo "4. Testing prole-agent runs from writable directory..."
mkdir -p /tmp/scan-test
cd /tmp/scan-test
/Users/chrisfu/dev/prole/prole-net/prole-agent 2>&1 &
SCAN_PID=$!
sleep 2
if ps -p $SCAN_PID > /dev/null 2>&1; then
echo " ✓ prole-agent runs successfully"
kill $SCAN_PID 2>/dev/null
wait 2>/dev/null
else
echo " ✗ prole-agent failed to start"
exit 1
fi
cd /Users/chrisfu/dev/prole
# Test 5: Code uses scan directory
echo "5. Testing code uses scan directory..."
if grep -q "scan_dir = prole_home / \"scan\"" install.py && \
grep -q "cwd=str(scan_dir)" install.py; then
echo " ✓ Code properly uses scan directory"
else
echo " ✗ Code not updated to use scan directory"
exit 1
fi
# Cleanup test directories
rm -rf ~/.prole/scan 2>/dev/null
echo ""
echo "========================================"
echo " ✓ All Network Scan Fix Tests Passed"
echo "========================================"
echo ""
echo "Network scan will now work correctly:"
echo " • From source: Uses writable cwd"
echo " • From package: Uses ~/.prole/scan"
echo ""
echo "Scan directory: ~/.prole/scan"
echo "Purpose: Writable working directory for prole-agent"
echo ""