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).
31 lines
1.1 KiB
Bash
Executable File
31 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
# Bootstrap server Tor configuration tests
|
|
set -euo pipefail
|
|
|
|
PASS=0
|
|
FAIL=0
|
|
|
|
pass() { echo " ✓ $*"; ((PASS++)) || true; }
|
|
fail() { echo " ✗ $*"; ((FAIL++)) || true; }
|
|
|
|
TORRC="/root/tri-bootstrap-server/tor/torrc.template"
|
|
|
|
# Test 1: torrc.template exists
|
|
echo "=== Test: torrc.template exists ==="
|
|
[ -f "$TORRC" ] && pass "torrc.template exists" || fail "torrc.template missing"
|
|
|
|
# Test 2: Has required Tor settings
|
|
echo "=== Test: Tor configuration ==="
|
|
grep -q "HiddenServiceDir" "$TORRC" && pass "Has HiddenServiceDir" || fail "Missing HiddenServiceDir"
|
|
grep -q "HiddenServiceVersion 3" "$TORRC" && pass "Uses V3 onion service" || fail "Missing V3 onion config"
|
|
grep -q "HiddenServicePort" "$TORRC" && pass "Has HiddenServicePort" || fail "Missing HiddenServicePort"
|
|
grep -q "ExcludeSingleHopRelays" "$TORRC" && pass "Has ExcludeSingleHopRelays" || fail "Missing ExcludeSingleHopRelays"
|
|
|
|
# Test 3: Has correct Tor port mappings
|
|
echo "=== Test: Port mappings ==="
|
|
grep -q "HiddenServicePort 80" "$TORRC" && pass "Maps HS port 80" || fail "Missing HS port 80"
|
|
|
|
echo ""
|
|
echo "Results: $PASS passed, $FAIL failed"
|
|
[ "$FAIL" -eq 0 ]
|