agent-governance/ledger/test_api.sh
profit 77655c298c Initial commit: Agent Governance System Phase 8
Phase 8 Production Hardening with complete governance infrastructure:

- Vault integration with tiered policies (T0-T4)
- DragonflyDB state management
- SQLite audit ledger
- Pipeline DSL and templates
- Promotion/revocation engine
- Checkpoint system for session persistence
- Health manager and circuit breaker for fault tolerance
- GitHub/Slack integrations
- Architectural test pipeline with bug watcher, suggestion engine, council review
- Multi-agent chaos testing framework

Test Results:
- Governance tests: 68/68 passing
- E2E workflow: 16/16 passing
- Phase 2 Vault: 14/14 passing
- Integration tests: 27/27 passing

Coverage: 57.6% average across 12 phases

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 22:07:06 -05:00

69 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
# Test Ledger API
set -e
PORT=8081
BASE_URL="http://localhost:${PORT}"
echo "=== Testing Ledger API ==="
# Start API in background
export LEDGER_API_AUTH=false
export LEDGER_API_PORT=$PORT
cd /opt/agent-governance/ledger
python3 api.py > /tmp/ledger-api.log 2>&1 &
API_PID=$!
sleep 3
cleanup() {
kill $API_PID 2>/dev/null || true
}
trap cleanup EXIT
# Test endpoints
echo ""
echo "1. Health Check:"
curl -s "${BASE_URL}/health"
echo ""
echo ""
echo "2. Root:"
curl -s "${BASE_URL}/"
echo ""
echo ""
echo "3. List Agents:"
curl -s "${BASE_URL}/agents"
echo ""
echo ""
echo "4. Get Stats:"
curl -s "${BASE_URL}/stats"
echo ""
echo ""
echo "5. Create Test Agent:"
curl -s -X POST "${BASE_URL}/agents" \
-H "Content-Type: application/json" \
-d '{"agent_id":"api-test-agent","current_tier":0}'
echo ""
echo ""
echo "6. List Violations:"
curl -s "${BASE_URL}/violations"
echo ""
echo ""
echo "7. List Promotions:"
curl -s "${BASE_URL}/promotions"
echo ""
echo ""
echo "8. Orchestration Summary:"
curl -s "${BASE_URL}/orchestration/summary"
echo ""
echo ""
echo "=== All Tests Complete ==="