#!/bin/bash # Bootstrap server generate-bootstrap.sh tests set -euo pipefail PASS=0 FAIL=0 pass() { echo " ✓ $*"; ((PASS++)) || true; } fail() { echo " ✗ $*"; ((FAIL++)) || true; } SCRIPT="/root/tri-bootstrap-server/scripts/generate-bootstrap.sh" # Test 1: generate-bootstrap.sh exists echo "=== Test: generate-bootstrap.sh exists ===" [ -f "$SCRIPT" ] && pass "generate-bootstrap.sh exists" || fail "generate-bootstrap.sh missing" # Test 2: Checks for required files before archiving echo "=== Test: Bootstrap generation ===" grep -qE "blk0001|blocks" "$SCRIPT" && pass "Checks blockchain data files" || fail "Missing blockchain data check" grep -qE "txleveldb|database" "$SCRIPT" && pass "Checks database files" || fail "Missing database check" grep -qE "tar|gzip|compress" "$SCRIPT" && pass "Uses compression/archiving" || fail "Missing compression" # Test 3: Excludes wallet and private data echo "=== Test: Security - excludes private data ===" grep -qE "exclude.*wallet|wallet.*exclude" "$SCRIPT" && pass "Excludes wallet data" || fail "Wallet data exclusion missing" grep -qE "exclude.*onion|exclude.*tor_data|exclude.*debug" "$SCRIPT" && pass "Excludes private runtime data" || fail "Private runtime data exclusion missing" # Test 4: verify-bootstrap.sh exists and functional echo "=== Test: verify-bootstrap.sh exists ===" [ -f "/root/tri-bootstrap-server/scripts/verify-bootstrap.sh" ] && pass "verify-bootstrap.sh exists" || fail "verify-bootstrap.sh missing" echo "" echo "Results: $PASS passed, $FAIL failed" [ "$FAIL" -eq 0 ]