-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathe2e-test.sh
More file actions
executable file
·181 lines (155 loc) · 4.99 KB
/
Copy pathe2e-test.sh
File metadata and controls
executable file
·181 lines (155 loc) · 4.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
#!/usr/bin/env bash
# NESS Stack E2E Test - v2.1
# Tests each component and shows actual errors
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" 2>/dev/null && pwd || echo ".")"
cd "$SCRIPT_DIR"
# Detect engine
if command -v podman-compose &>/dev/null && podman info &>/dev/null 2>&1; then
ENGINE="podman-compose"
RUNTIME="podman"
COMPOSE_CMD="podman-compose"
elif command -v docker-compose &>/dev/null; then
ENGINE="docker-compose"
RUNTIME="docker"
COMPOSE_CMD="docker-compose"
else
echo "[ERROR] No container engine found (podman-compose or docker-compose)"
exit 1
fi
TEST_LOG="$SCRIPT_DIR/test-results.log"
echo "=== NESS E2E Test $(date) ===" > "$TEST_LOG"
cyan="\033[1;36m"
green="\033[1;32m"
red="\033[1;31m"
yellow="\033[1;33m"
reset="\033[0m"
log() {
echo -e "${cyan}[$(date '+%H:%M:%S')]${reset} $1" | tee -a "$TEST_LOG"
}
fail() {
echo -e "${red}[FAIL]${reset} $1" | tee -a "$TEST_LOG"
((FAIL_COUNT++)) || true
}
pass() {
echo -e "${green}[PASS]${reset} $1" | tee -a "$TEST_LOG"
((PASS_COUNT++)) || true
}
warn() {
echo -e "${yellow}[WARN]${reset} $1" | tee -a "$TEST_LOG"
}
PASS_COUNT=0
FAIL_COUNT=0
log "=== NESS Stack E2E Test ==="
log "Engine: $ENGINE / $RUNTIME"
log "Working directory: $(pwd)"
# Test 2: Compose File Valid
log "Test 2: Checking docker-compose.yml..."
if $COMPOSE_CMD config > /dev/null 2>&1; then
pass "docker-compose.yml syntax valid"
else
fail "docker-compose.yml has errors"
$COMPOSE_CMD config 2>&1 | head -20
fi
# Test 3: Volume Creation
log "Test 3: Checking volumes..."
for vol in emercoin-data skywire-data; do
if $RUNTIME volume ls 2>/dev/null | grep -q "$vol"; then
pass "Volume $vol exists"
else
log " Creating $vol..."
if $RUNTIME volume create "$vol" 2>/dev/null; then
pass "Volume $vol created"
else
fail "Volume $vol creation failed"
fi
fi
done
services=(
"emercoin-core:6661:tcp:Emercoin RPC"
"privateness:6660:tcp:Privateness RPC"
"dns-reverse-proxy:1053:tcp:DNS Proxy"
"pyuheprng-privatenesstools:5000:tcp:pyuheprng"
"softether-vpn:5555:tcp:SoftEther Management"
)
for service in "${services[@]}"; do
IFS=':' read -r container port protocol label <<< "$service"
# Container running check
if ! $RUNTIME ps --format '{{.Names}}' | grep -q "^${container}$"; then
fail "Container ${container} not running"
fi
# Port connectivity check
if command -v nc >/dev/null 2>&1; then
if nc -z localhost "$port" >/dev/null 2>&1; then
pass "${label} port ${port} accessible"
else
fail "${label} port ${port} unreachable"
fi
else
warn "nc not available - skipping port ${port} check"
fi
done
# Test 4: Emercoin RPC test
log "Testing Emercoin RPC connectivity..."
if $RUNTIME exec emercoin-core emercoin-cli -datadir=/data getblockchaininfo >/dev/null 2>&1; then
pass "Emercoin RPC responding"
else
warn "Emercoin RPC not responding (may be syncing)"
fi
# Test 5: DNS resolution test
log "Testing DNS resolution..."
if command -v dig >/dev/null 2>&1; then
if dig @127.0.0.1 -p 1053 +short example.com >/dev/null 2>&1; then
pass "DNS reverse proxy resolving queries"
else
warn "DNS proxy not resolving queries"
fi
else
warn "dig not available - skipping DNS test"
fi
# Test 6: SoftEther management console
log "Testing SoftEther management..."
if $RUNTIME exec softether-vpn /usr/local/vpnserver/vpncmd localhost:5555 /SERVER /CMD ServerStatusGet >/dev/null 2>&1; then
pass "SoftEther VPN management console accessible"
else
warn "SoftEther VPN management console not responding"
fi
# Test 7: Service interdependencies
log "Testing service interdependencies..."
dependencies=(
"privateness:emercoin-core"
"dns-reverse-proxy:emercoin-core"
"pyuheprng-privatenesstools:emercoin-core"
)
for dep in "${dependencies[@]}"; do
IFS=':' read -r service dependency <<< "$dep"
if $RUNTIME inspect "$service" | grep -q "$dependency"; then
pass "${service} depends on ${dependency}"
else
warn "${service} dependency check failed"
fi
done
# Test 8: Resource usage
log "Checking resource usage..."
$RUNTIME stats --no-stream --format "table {{.Container}}\t{{.CPUPerc}}\t{{.MemUsage}}" | tee -a "$TEST_LOG"
# Test 9: Volume integrity
log "Verifying volume mounts..."
volumes=("emercoin-data" "yggdrasil-data" "i2p-data" "skywire-data" "softether-data")
for vol in "${volumes[@]}"; do
if $RUNTIME volume inspect "$vol" >/dev/null 2>&1; then
pass "Volume ${vol} exists"
else
fail "Volume ${vol} missing"
fi
done
# Test 10: Network connectivity
log "Testing network connectivity..."
if $RUNTIME network inspect ness-network >/dev/null 2>&1; then
pass "Ness network bridge created"
else
fail "Ness network bridge missing"
fi
log "E2E test suite completed!"
echo -e "\n${green}Test Summary:${reset}"
echo "Passed: $PASS_COUNT | Failed: $FAIL_COUNT"
echo "Logs: $TEST_LOG"