upleb.uk

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

summaryrefslogtreecommitdiff
path: root/test_relay.sh
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2025-11-04 10:42:18 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2025-11-04 10:42:18 +0000
commit9394657613014891ff91db6cd0a01b21bb257053 (patch)
treee59ff64c5463039e4304928b3b24377e3e438822 /test_relay.sh
parent52bad9954cdddf55ab749fd0c6387edbc766632f (diff)
feat: implement NIP-01 compliant Nostr relay
- WebSocket-based relay using tokio-tungstenite - Full NIP-01 protocol support (EVENT, REQ, CLOSE) - Event validation (signature and ID) - In-memory event storage - Filter support (IDs, authors, kinds, since/until) - Configuration via environment variables - Nix flake for reproducible builds - Test automation script All 6 NIP-01 smoke tests passing (100%)
Diffstat (limited to 'test_relay.sh')
-rwxr-xr-xtest_relay.sh49
1 files changed, 49 insertions, 0 deletions
diff --git a/test_relay.sh b/test_relay.sh
new file mode 100755
index 0000000..be463fa
--- /dev/null
+++ b/test_relay.sh
@@ -0,0 +1,49 @@
1#!/usr/bin/env bash
2set -e
3
4echo "๐Ÿงช Testing ngit-grasp NIP-01 relay"
5echo ""
6
7# Start the relay in the background
8echo "๐Ÿ“ก Starting relay on port 9000..."
9cd grasp-audit
10nix develop -c bash -c "cd .. && NGIT_BIND_ADDRESS=127.0.0.1:9000 RUST_LOG=info cargo run" > /tmp/relay.log 2>&1 &
11RELAY_PID=$!
12cd ..
13
14echo "Relay PID: $RELAY_PID"
15echo "Waiting for relay to start..."
16sleep 3
17
18# Check if relay is running
19if ! ps -p $RELAY_PID > /dev/null; then
20 echo "โŒ Relay failed to start"
21 cat /tmp/relay.log
22 exit 1
23fi
24
25echo "โœ… Relay started"
26echo ""
27
28# Run the audit
29echo "๐Ÿ” Running NIP-01 smoke tests..."
30cd grasp-audit
31nix develop -c cargo run -- audit --relay ws://127.0.0.1:9000 --spec nip01-smoke
32
33# Capture exit code
34AUDIT_EXIT=$?
35
36# Stop the relay
37echo ""
38echo "๐Ÿ›‘ Stopping relay..."
39kill $RELAY_PID 2>/dev/null || true
40wait $RELAY_PID 2>/dev/null || true
41
42# Show relay log if there were errors
43if [ $AUDIT_EXIT -ne 0 ]; then
44 echo ""
45 echo "๐Ÿ“‹ Relay log:"
46 cat /tmp/relay.log
47fi
48
49exit $AUDIT_EXIT