Files
proxmox/scripts/archive/test/test-integration.sh
defiQUG fbda1b4beb
Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
docs: Ledger Live integration, contract deploy learnings, NEXT_STEPS updates
- ADD_CHAIN138_TO_LEDGER_LIVE: Ledger form done; public code review repo bis-innovations/LedgerLive; init/push commands
- CONTRACT_DEPLOYMENT_RUNBOOK: Chain 138 gas price 1 gwei, 36-addr check, TransactionMirror workaround
- CONTRACT_*: AddressMapper, MirrorManager deployed 2026-02-12; 36-address on-chain check
- NEXT_STEPS_FOR_YOU: Ledger done; steps completable now (no LAN); run-completable-tasks-from-anywhere
- MASTER_INDEX, OPERATOR_OPTIONAL, SMART_CONTRACTS_INVENTORY_SIMPLE: updates
- LEDGER_BLOCKCHAIN_INTEGRATION_COMPLETE: bis-innovations/LedgerLive reference

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 15:46:57 -08:00

106 lines
3.3 KiB
Bash
Executable File

#!/bin/bash
set -euo pipefail
# Test UniFi integration components
set +e # Don't exit on errors, we handle them in test_step
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
cd "$PROJECT_ROOT"
echo "UniFi Integration Test Suite"
echo "============================"
echo ""
# Load environment variables
if [ -f ~/.env ]; then
source <(grep "^UNIFI_" ~/.env | sed 's/^/export /')
fi
# Test counters
TESTS_PASSED=0
TESTS_FAILED=0
test_step() {
local test_name="$1"
local test_command="$2"
echo -n "Testing: $test_name... "
if eval "$test_command" >/dev/null 2>&1; then
echo "✅ PASS"
((TESTS_PASSED++))
return 0
else
echo "❌ FAIL"
((TESTS_FAILED++))
return 1
fi
}
echo "1. Package Build Verification"
echo "----------------------------"
test_step "unifi-api package built" "test -f unifi-api/dist/index.js"
test_step "mcp-unifi package built" "test -f mcp-unifi/dist/index.js"
test_step "CLI script exists" "test -f unifi-api/dist/cli/index.js"
echo ""
echo "2. Configuration Verification"
echo "----------------------------"
test_step "Environment file exists" "test -f ~/.env"
test_step "UNIFI_UDM_URL configured" "[ -n \"\$UNIFI_UDM_URL\" ]"
test_step "UNIFI_API_MODE configured" "[ -n \"\$UNIFI_API_MODE\" ]"
if [ "$UNIFI_API_MODE" = "official" ]; then
test_step "UNIFI_API_KEY configured" "[ -n \"\$UNIFI_API_KEY\" ]"
else
test_step "UNIFI_USERNAME configured" "[ -n \"\$UNIFI_USERNAME\" ]"
test_step "UNIFI_PASSWORD configured" "[ -n \"\$UNIFI_PASSWORD\" ]"
fi
echo ""
echo "3. Script Verification"
echo "---------------------"
test_step "list-sites.sh exists and executable" "test -x scripts/unifi/list-sites.sh"
test_step "check-health.sh exists and executable" "test -x scripts/unifi/check-health.sh"
test_step "list-devices.sh exists and executable" "test -x scripts/unifi/list-devices.sh"
test_step "monitor-health.sh exists and executable" "test -x scripts/unifi/monitor-health.sh"
echo ""
echo "4. Documentation Verification"
echo "---------------------------"
test_step "UNIFI_API_SETUP.md exists" "test -f docs/04-configuration/UNIFI_API_SETUP.md"
test_step "UNIFI_ENDPOINTS_REFERENCE.md exists" "test -f docs/04-configuration/UNIFI_ENDPOINTS_REFERENCE.md"
test_step "Scripts README exists" "test -f scripts/unifi/README.md"
echo ""
echo "5. API Connection Test (if configured)"
echo "-------------------------------------"
if [ -n "$UNIFI_UDM_URL" ] && [ -n "$UNIFI_API_MODE" ]; then
echo -n "Testing API connection... "
if NODE_TLS_REJECT_UNAUTHORIZED=0 pnpm --filter unifi-api exec node dist/cli/index.js sites 2>&1 | grep -q "internalReference\|name" >/dev/null 2>&1; then
echo "✅ PASS"
((TESTS_PASSED++))
else
echo "⚠️ SKIP (connection test may fail if controller is unavailable)"
echo " Run './scripts/unifi/check-health.sh' for detailed connection test"
fi
else
echo "⚠️ SKIP (configuration not complete)"
fi
echo ""
echo "Test Summary"
echo "============"
echo "✅ Passed: $TESTS_PASSED"
echo "❌ Failed: $TESTS_FAILED"
echo ""
if [ $TESTS_FAILED -eq 0 ]; then
echo "🎉 All tests passed!"
exit 0
else
echo "⚠️ Some tests failed. Please review the output above."
exit 1
fi