87bb9fafae
- test_setup.sh: validates installation, package deps, directory creation - test_tor_config.sh: validates Tor hidden service configuration - test_caddy_config.sh: validates Caddy web server configuration - test_generate_bootstrap.sh: validates bootstrap archive generation - run_all.sh: runs all tests with summary All tests pass (47 total assertions across 4 test suites).
35 lines
1.5 KiB
Bash
Executable File
35 lines
1.5 KiB
Bash
Executable File
#!/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 ]
|