-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
287 lines (237 loc) · 9.25 KB
/
Copy pathjustfile
File metadata and controls
287 lines (237 loc) · 9.25 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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
# Vixy development commands
# Default: show available commands
default:
@just --list
# =============================================================================
# Development
# =============================================================================
# Format code
fmt:
cargo fmt
# Check formatting without modifying
fmt-check:
cargo fmt --check
# Run clippy lints
clippy:
cargo clippy -- -D warnings
# Run unit tests
test:
cargo test
# Run BDD tests (cucumber, excludes @integration)
test-bdd:
cargo test --test cucumber
# Run all unit tests (lib + BDD)
test-all:
cargo test
cargo test --test cucumber
# Run full CI checks (fmt, clippy, tests)
ci:
@echo "Running CI checks..."
@echo "==> Checking formatting..."
cargo fmt --check
@echo "==> Running clippy..."
cargo clippy -- -D warnings
@echo "==> Running tests..."
cargo test
@echo "==> All CI checks passed!"
# Build the project
build:
cargo build
# Build release version
build-release:
cargo build --release
# Run the proxy with config file
run config="config.example.toml":
cargo run -- --config {{config}}
# Clean build artifacts
clean:
cargo clean
# =============================================================================
# Kurtosis Integration Tests
# =============================================================================
# Start Kurtosis Ethereum testnet and generate config
kurtosis-up:
@echo "Starting Kurtosis Ethereum testnet..."
./scripts/setup-kurtosis.sh
# Stop and remove Kurtosis testnet
kurtosis-down:
@echo "Stopping Kurtosis testnet..."
kurtosis enclave rm -f vixy-testnet || true
# Show Kurtosis enclave status
kurtosis-status:
kurtosis enclave inspect vixy-testnet
# Regenerate Vixy config from existing Kurtosis enclave
kurtosis-config:
./scripts/setup-kurtosis.sh
# Run Vixy with Kurtosis-generated config
kurtosis-vixy:
@if [ ! -f kurtosis/vixy-kurtosis.toml ]; then \
echo "Error: kurtosis/vixy-kurtosis.toml not found."; \
echo "Run 'just kurtosis-up' first to start Kurtosis and generate config."; \
exit 1; \
fi
RUST_LOG=info cargo run -- --config kurtosis/vixy-kurtosis.toml
# Run integration tests (requires Vixy to be running)
kurtosis-test:
@echo "Running integration tests..."
@echo "Make sure Vixy is running with 'just kurtosis-vixy' in another terminal"
cargo test --test integration_cucumber
# Full integration test: start Kurtosis, run Vixy, test, cleanup
integration-test: build-release
#!/usr/bin/env bash
set -e
echo "════════════════════════════════════════════════════════════════"
echo " Kurtosis Integration Tests"
echo "════════════════════════════════════════════════════════════════"
echo ""
echo "==> Setting up Kurtosis testnet..."
./scripts/setup-kurtosis.sh
echo "==> Starting Vixy with Kurtosis config..."
RUST_LOG=info ./target/release/vixy --config kurtosis/vixy-kurtosis.toml &
VIXY_PID=$!
# Wait for Vixy to start
echo "==> Waiting for Vixy to start..."
for i in {1..30}; do
if curl -s http://127.0.0.1:8080/status > /dev/null 2>&1; then
echo "==> Vixy is ready!"
break
fi
if [ $i -eq 30 ]; then
echo "Error: Vixy failed to start"
kill $VIXY_PID 2>/dev/null || true
exit 1
fi
sleep 1
done
echo "==> Running Kurtosis integration tests..."
VIXY_SKIP_INTEGRATION_CHECK=1 cargo test --test integration_cucumber -- --color always
KURTOSIS_TEST_RESULT=$?
echo "==> Stopping Vixy..."
kill $VIXY_PID 2>/dev/null || true
sleep 2
if [ $KURTOSIS_TEST_RESULT -eq 0 ]; then
echo "✓ Kurtosis integration tests passed!"
else
echo "✗ Kurtosis integration tests failed!"
exit $KURTOSIS_TEST_RESULT
fi
echo ""
echo "════════════════════════════════════════════════════════════════"
echo " WSS Integration Tests (External)"
echo "════════════════════════════════════════════════════════════════"
echo ""
echo "==> Starting Vixy with WSS test config..."
RUST_LOG=info ./target/release/vixy --config config.wss-test.toml &
VIXY_PID=$!
# Wait for Vixy to start
echo "==> Waiting for Vixy to start..."
for i in {1..30}; do
if curl -s http://127.0.0.1:8080/health > /dev/null 2>&1; then
echo "==> Vixy is ready!"
break
fi
if [ $i -eq 30 ]; then
echo "⚠ Vixy failed to start for WSS tests"
kill $VIXY_PID 2>/dev/null || true
echo "⚠ Skipping WSS tests"
exit 0
fi
sleep 1
done
echo "==> Running WSS integration tests..."
echo "Note: Tests use public Hoodi endpoints and may fail due to:"
echo " - Network issues"
echo " - Endpoint rate limiting"
echo " - Endpoint unavailability"
echo ""
VIXY_WSS_ONLY=1 VIXY_SKIP_INTEGRATION_CHECK=1 cargo test --test integration_cucumber -- --color always
WSS_TEST_RESULT=$?
echo "==> Stopping Vixy..."
kill $VIXY_PID 2>/dev/null || true
echo ""
echo "════════════════════════════════════════════════════════════════"
echo " Integration Test Summary"
echo "════════════════════════════════════════════════════════════════"
if [ $WSS_TEST_RESULT -eq 0 ]; then
echo "✓ Kurtosis tests: PASSED"
echo "✓ WSS tests: PASSED"
echo ""
echo "All integration tests passed!"
exit 0
else
echo "✓ Kurtosis tests: PASSED"
echo "⚠ WSS tests: FAILED (may be due to external endpoint issues)"
echo ""
echo "⚠ WSS test failures are non-critical and may be due to:"
echo " - Public endpoint unavailability"
echo " - Network connectivity issues"
echo " - Rate limiting"
echo ""
echo "This does not indicate a problem with WSS/TLS implementation."
exit 0
fi
# Clean up everything including Kurtosis
clean-all: kurtosis-down clean
rm -f kurtosis/vixy-kurtosis.toml
# =============================================================================
# WSS Integration Tests (External)
# =============================================================================
# Run WSS integration tests (uses public Hoodi endpoints)
# Note: May fail if public endpoints are unavailable
test-wss: build-release
#!/usr/bin/env bash
set -e
echo "==> Starting Vixy with WSS test config..."
RUST_LOG=info ./target/release/vixy --config config.wss-test.toml &
VIXY_PID=$!
# Wait for Vixy to start
echo "==> Waiting for Vixy to start..."
for i in {1..30}; do
if curl -s http://127.0.0.1:8080/health > /dev/null 2>&1; then
echo "==> Vixy is ready!"
break
fi
if [ $i -eq 30 ]; then
echo "Error: Vixy failed to start"
kill $VIXY_PID 2>/dev/null || true
exit 1
fi
sleep 1
done
echo "==> Running WSS integration tests..."
echo "Note: Tests use public Hoodi endpoints and may fail due to:"
echo " - Network issues"
echo " - Endpoint rate limiting"
echo " - Endpoint unavailability"
echo ""
VIXY_WSS_ONLY=1 VIXY_SKIP_INTEGRATION_CHECK=1 cargo test --test integration_cucumber -- --color always || {
echo ""
echo "⚠ WSS tests failed - this is expected if public endpoints are unavailable"
echo " This does not indicate a problem with the WSS/TLS implementation"
TEST_RESULT=1
}
echo "==> Stopping Vixy..."
kill $VIXY_PID 2>/dev/null || true
if [ "${TEST_RESULT:-0}" -eq 0 ]; then
echo "==> WSS tests passed!"
else
echo "==> WSS tests failed (may be due to external endpoint issues)"
exit 1
fi
# =============================================================================
# Utility Commands
# =============================================================================
# Check Vixy status (requires running instance)
status:
@curl -s http://127.0.0.1:8080/status | jq . || echo "Vixy not running"
# Check Vixy metrics (requires running instance)
metrics:
@curl -s http://127.0.0.1:9090/metrics || echo "Metrics not available"
# Quick EL proxy test
test-el:
@curl -s -X POST http://127.0.0.1:8080/el \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' | jq .
# Quick CL proxy test
test-cl:
@curl -s http://127.0.0.1:8080/cl/eth/v1/node/health && echo "CL health: OK"