|
7 | 7 | @LC_ALL=C $(MAKE) -pRrq -f $(firstword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/(^|\n)# Files(\n|$$)/,/(^|\n)# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' |
8 | 8 |
|
9 | 9 | manual-test-laser: |
10 | | - @echo "Preparing for laser test..." |
| 10 | + @echo "Checking for Helius API key" |
11 | 11 | @if [ -z "$$HELIUS_API_KEY" ]; then \ |
12 | 12 | echo "Error: HELIUS_API_KEY environment variable not set"; \ |
13 | 13 | exit 1; \ |
14 | 14 | fi |
15 | | - @echo "Extracting keypair path..." |
| 15 | + @echo |
| 16 | + @echo "## Extracting keypair path..." |
16 | 17 | $(eval KEYPAIR_PATH := $(shell solana config get | grep "Keypair Path:" | cut -d: -f2 | xargs)) |
17 | 18 | @echo "Keypair path: $(KEYPAIR_PATH)" |
18 | | - @echo "Extracting pubkey..." |
| 19 | + @echo |
| 20 | + @echo "## Airdropping 1 SOL to pubkey on devnet" |
19 | 21 | $(eval PUBKEY := $(shell solana-keygen pubkey $(KEYPAIR_PATH))) |
20 | 22 | @echo "Pubkey: $(PUBKEY)" |
21 | 23 | @echo "Airdropping 1 SOL to $(PUBKEY)..." |
22 | 24 | @solana airdrop 1 $(PUBKEY) --url devnet || true |
23 | | - @echo "Creating validator config..." |
| 25 | + @echo |
| 26 | + @echo "## Creating validator config..." |
24 | 27 | @echo "[accounts]" > /tmp/mb-test-laser.toml |
25 | 28 | @echo "remote.url = \"https://devnet.helius-rpc.com/?api-key=$(HELIUS_API_KEY)\"" >> /tmp/mb-test-laser.toml |
26 | 29 | @echo "remote.ws-url = [\"https://laserstream-devnet-ewr.helius-rpc.com?api-key=$(HELIUS_API_KEY)\"]" >> /tmp/mb-test-laser.toml |
27 | 30 | @echo "" >> /tmp/mb-test-laser.toml |
28 | 31 | @echo "[rpc]" >> /tmp/mb-test-laser.toml |
29 | 32 | @echo "addr = \"0.0.0.0\"" >> /tmp/mb-test-laser.toml |
30 | | - @echo "port = 8899" >> /tmp/mb-test-laser.toml |
31 | | - @echo "Starting validator in background..." |
32 | | - RUST_LOG=magicblock_chainlink=debug,magicblock_accounts=debug \ |
33 | | - cargo run --bin magicblock-validator -- \ |
34 | | - --config /tmp/mb-test-laser.toml --ephemeral \ |
35 | | - > /tmp/validator.log 2>&1 & |
| 33 | + @echo "port = 9988" >> /tmp/mb-test-laser.toml |
| 34 | + @echo |
| 35 | + @echo "## Starting validator in background..." |
| 36 | + RUST_LOG=warn,magicblock=info,magicblock_chainlink=debug,magicblock_accounts=debug \ |
| 37 | + cargo run --bin magicblock-validator --manifest-path=$(DIR)../Cargo.toml \ |
| 38 | + -- --ledger-resume-strategy-kind=reset \ |
| 39 | + -- /tmp/mb-test-laser.toml \ |
| 40 | + > /tmp/validator.log 2>&1 & |
36 | 41 | @echo $$! > /tmp/validator.pid |
37 | | - @sleep 3 |
38 | | - @echo "Running laser test..." |
39 | | - cd helius-laser && KEYPAIR_PATH=$(KEYPAIR_PATH) RUST_LOG=info cargo run |
40 | | - @echo "Validator logs:" |
41 | | - @cat /tmp/validator.log || true |
42 | | - @echo "Cleaning up validator..." |
43 | | - @if [ -f /tmp/validator.pid ]; then kill $$(cat /tmp/validator.pid) 2>/dev/null || true; rm /tmp/validator.pid /tmp/validator.log; fi |
| 42 | + @echo |
| 43 | + @echo "### Waiting until validator listens on port 9988... via solana cluster-version" |
| 44 | + @until solana cluster-version --url http://127.0.0.1:9988 >/dev/null 2>&1; do \ |
| 45 | + sleep 1; \ |
| 46 | + done |
| 47 | + @echo |
| 48 | + @echo "## Running laser test..." |
| 49 | + KEYPAIR_PATH=$(KEYPAIR_PATH) \ |
| 50 | + RUST_LOG=info \ |
| 51 | + cargo run --bin helius-laser |
| 52 | + @echo |
| 53 | + @if [ $$? -ne 0 ]; then \ |
| 54 | + echo "## Laser test failed, showing validator logs"; \ |
| 55 | + cat /tmp/validator.log || true; \ |
| 56 | + echo "⛔ TEST FAILED"; \ |
| 57 | + else \ |
| 58 | + echo "✅ TEST PASSED"; \ |
| 59 | + fi |
| 60 | + @echo |
| 61 | + @if [ -f /tmp/validator.pid ]; then \ |
| 62 | + echo "## Shutting down validator"; \ |
| 63 | + kill $$(cat /tmp/validator.pid) 2>/dev/null || true; \ |
| 64 | + rm /tmp/validator.pid /tmp/validator.log ; \ |
| 65 | + fi |
0 commit comments