upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile91
1 files changed, 58 insertions, 33 deletions
diff --git a/Makefile b/Makefile
index 2ed8e07..40f0e7b 100644
--- a/Makefile
+++ b/Makefile
@@ -17,12 +17,15 @@ NODE ?= node
17NPM ?= npm 17NPM ?= npm
18PYTHON ?= python3 18PYTHON ?= python3
19 19
20TOLLGATE_IP ?= 10.192.45.1
21
20.PHONY: help setup detect-ports detect-chip detect-all 22.PHONY: help setup detect-ports detect-chip detect-all
21.PHONY: flash flash-a flash-b monitor monitor-a monitor-b 23.PHONY: flash flash-a flash-b monitor monitor-a monitor-b
22.PHONY: test smoke test-api test-portal test-network test-full 24.PHONY: test test-unit test-integration test-e2e test-all
23.PHONY: tokens test-payment wallet-setup wallet-info wallet-balance mint-token send-token 25.PHONY: test-smoke test-api test-network test-portal test-payment
24.PHONY: clean erase-nvs reset serial-log 26.PHONY: test-reset-auth test-session-expiry test-dns-firewall
25.PHONY: bootstrap-config 27.PHONY: tokens wallet-setup wallet-info wallet-balance mint-token send-token
28.PHONY: clean erase-nvs reset serial-log bootstrap-config
26 29
27help: 30help:
28 @echo "TollGate ESP32 — Makefile" 31 @echo "TollGate ESP32 — Makefile"
@@ -38,25 +41,24 @@ help:
38 @echo " flash-b Flash to PORT_B" 41 @echo " flash-b Flash to PORT_B"
39 @echo " monitor Serial monitor on PORT" 42 @echo " monitor Serial monitor on PORT"
40 @echo "" 43 @echo ""
41 @echo "Test (Phase 1):" 44 @echo "Testing:"
42 @echo " test Run all Phase 1 tests" 45 @echo " test-unit Host C unit tests (no hardware)"
43 @echo " smoke Quick 30s smoke test" 46 @echo " test-integration Node.js integration tests (live board)"
44 @echo " test-api curl API endpoint tests" 47 @echo " test-e2e Playwright browser E2E tests"
45 @echo " test-portal Playwright captive portal tests" 48 @echo " test-all Run all three test layers"
46 @echo " test-network DNS/NAT connectivity tests" 49 @echo " test-smoke Quick 30s smoke test"
47 @echo " test-full All 14 Phase 1 tests" 50 @echo " test-reset-auth Reset auth + per-client NAT filter test"
51 @echo " test-dns-firewall DNS hijack + NAT filter test"
52 @echo " test-session-expiry Session lifecycle with 65s expiry wait"
48 @echo "" 53 @echo ""
49 @echo "Test (Phase 2):" 54 @echo "Wallet:"
50 @echo " wallet-setup Initialize nutshell wallet for test mint" 55 @echo " wallet-setup Initialize nutshell wallet for test mint"
51 @echo " wallet-info Show mint info" 56 @echo " wallet-info Show mint info"
52 @echo " wallet-balance Show wallet balance" 57 @echo " wallet-balance Show wallet balance"
53 @echo " mint-token Invoice + send test token (AMOUNT=21)" 58 @echo " mint-token Invoice + send test token (AMOUNT=21)"
54 @echo " send-token Send cashuA token (AMOUNT=21)" 59 @echo " send-token Send cashuA token (AMOUNT=21)"
55 @echo " tokens Alias for send-token"
56 @echo " test-payment Payment flow tests"
57 @echo "" 60 @echo ""
58 @echo "Utilities:" 61 @echo "Utilities:"
59 @echo " setup One-time: install esptool, deps"
60 @echo " clean Clean build" 62 @echo " clean Clean build"
61 @echo " erase-nvs Erase NVS partition on PORT" 63 @echo " erase-nvs Erase NVS partition on PORT"
62 @echo " reset Hardware reset on PORT" 64 @echo " reset Hardware reset on PORT"
@@ -144,33 +146,60 @@ monitor-b: PORT=$(PORT_B)
144monitor-b: monitor 146monitor-b: monitor
145 147
146# ────────────────────────────────────────────── 148# ──────────────────────────────────────────────
147# Test Infrastructure 149# Testing
148# ────────────────────────────────────────────── 150# ──────────────────────────────────────────────
149 151
150test: test-api test-network 152test-unit:
151 @echo "=== All tests passed ===" 153 @echo "=== Running host unit tests ==="
154 $(MAKE) -C tests/unit test
155
156test-integration: test-api test-network test-reset-auth test-dns-firewall
157 @echo "=== Integration tests passed ==="
158
159test-e2e:
160 @echo "=== Running Playwright E2E tests ==="
161 cd tests/e2e && npx playwright test
162
163test-all: test-unit test-integration test-e2e
164 @echo "=== All test layers passed ==="
165
166test: test-unit test-integration
167 @echo "=== Tests passed ==="
152 168
153smoke: 169test-smoke:
154 @echo "=== Running smoke test (30s) ===" 170 @echo "=== Running smoke test (30s) ==="
155 $(NODE) tests/smoke.mjs $(PORT) 171 TOLLGATE_IP=$(TOLLGATE_IP) $(NODE) tests/integration/smoke.mjs
156 172
157test-api: 173test-api:
158 @echo "=== Running API tests ===" 174 @echo "=== Running API tests ==="
159 $(NODE) tests/api.mjs 175 TOLLGATE_IP=$(TOLLGATE_IP) $(NODE) tests/integration/api.mjs
176
177test-network:
178 @echo "=== Running network tests ==="
179 TOLLGATE_IP=$(TOLLGATE_IP) $(NODE) tests/integration/network.mjs
160 180
161test-portal: 181test-portal:
162 @echo "=== Running Playwright portal tests ===" 182 @echo "=== Running Playwright portal tests ==="
163 npx playwright test tests/captive-portal.spec.mjs 183 cd tests/e2e && npx playwright test captive-portal.spec.mjs
164 184
165test-network: 185test-payment:
166 @echo "=== Running network tests ===" 186 @echo "=== Running payment tests ==="
167 $(NODE) tests/network.mjs 187 TOLLGATE_IP=$(TOLLGATE_IP) $(NODE) tests/integration/phase2.mjs
188
189test-reset-auth:
190 @echo "=== Running reset auth test ==="
191 TOLLGATE_IP=$(TOLLGATE_IP) $(NODE) tests/integration/test-reset-auth.mjs
168 192
169test-full: test-api test-portal test-network 193test-session-expiry:
170 @echo "=== Full test suite passed ===" 194 @echo "=== Running session expiry test (65s wait, ~80s total) ==="
195 TOLLGATE_IP=$(TOLLGATE_IP) $(NODE) tests/integration/test-session-expiry.mjs
196
197test-dns-firewall:
198 @echo "=== Running DNS + firewall test ==="
199 TOLLGATE_IP=$(TOLLGATE_IP) $(NODE) tests/integration/test-dns-firewall.mjs
171 200
172# ────────────────────────────────────────────── 201# ──────────────────────────────────────────────
173# Phase 2: Payment Testing (Nutshell wallet) 202# Wallet
174# ────────────────────────────────────────────── 203# ──────────────────────────────────────────────
175 204
176wallet-setup: 205wallet-setup:
@@ -187,8 +216,8 @@ wallet-balance:
187 cashu --env-mint $(TEST_MINT) balance 216 cashu --env-mint $(TEST_MINT) balance
188 217
189mint-token: 218mint-token:
190 @echo "=== Minting test token (AMOUNT=$(or $(AMOUNT),21)) ==="
191 @AMOUNT=$${AMOUNT:-21}; \ 219 @AMOUNT=$${AMOUNT:-21}; \
220 echo "=== Minting test token ($$AMOUNT sats) ==="; \
192 cashu --env-mint $(TEST_MINT) invoice $$AMOUNT && \ 221 cashu --env-mint $(TEST_MINT) invoice $$AMOUNT && \
193 echo "--- Token (cashuA legacy) ---" && \ 222 echo "--- Token (cashuA legacy) ---" && \
194 cashu --env-mint $(TEST_MINT) send --legacy $$AMOUNT 223 cashu --env-mint $(TEST_MINT) send --legacy $$AMOUNT
@@ -200,10 +229,6 @@ send-token:
200 229
201tokens: send-token 230tokens: send-token
202 231
203test-payment:
204 @echo "=== Running payment tests ==="
205 $(NODE) tests/phase2.mjs
206
207# ────────────────────────────────────────────── 232# ──────────────────────────────────────────────
208# Utilities 233# Utilities
209# ────────────────────────────────────────────── 234# ──────────────────────────────────────────────