From 74c7b090a6ec7f749a3a79dcb0c9a0a6bc198702 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Wed, 5 Nov 2025 07:03:04 +0000 Subject: test: add ngit-relay integration testing instructions - Add RELAY_URL environment variable support to tests - Document expected behavior when testing against ngit-relay - Add test-ngit-relay.sh script for automated testing - Clarify that ngit-relay only accepts Git events (NIP-34) - Note that 4/6 NIP-01 smoke tests passing is expected - Key validation tests (invalid signature/ID) pass correctly - Add instructions for testing against general-purpose relays The validation tests passing confirms ngit-relay implements NIP-01 correctly, even though it has restrictive acceptance policies. --- grasp-audit/test-ngit-relay.sh | 46 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100755 grasp-audit/test-ngit-relay.sh (limited to 'grasp-audit/test-ngit-relay.sh') diff --git a/grasp-audit/test-ngit-relay.sh b/grasp-audit/test-ngit-relay.sh new file mode 100755 index 0000000..b719b86 --- /dev/null +++ b/grasp-audit/test-ngit-relay.sh @@ -0,0 +1,46 @@ +#!/bin/bash +set -e + +echo "๐Ÿงน Cleaning up old test data..." +# Use docker to cleanup with proper permissions +docker run --rm -v /tmp/ngit-test:/data alpine sh -c "rm -rf /data/*" 2>/dev/null || true +mkdir -p /tmp/ngit-test/{repos,blossom,relay-db,logs} + +echo "๐Ÿš€ Starting ngit-relay..." +# Remove any existing container with this name +docker rm -f ngit-relay-test 2>/dev/null || true +docker run --rm -d \ + --name ngit-relay-test \ + -p 8082:8081 \ + -e NGIT_DOMAIN=localhost \ + -e NGIT_RELAY_NAME="ngit-relay test instance" \ + -e NGIT_RELAY_DESCRIPTION="Test instance for grasp-audit" \ + -e NGIT_OWNER_NPUB="npub15qydau2hjma6ngxkl2cyar74wzyjshvl65za5k5rl69264ar2exs5cyejr" \ + -e NGIT_PROACTIVE_SYNC_GIT=false \ + -e NGIT_PROACTIVE_SYNC_BLOSSOM=false \ + -e NGIT_PROACTIVE_SYNC_NOSTR=false \ + -e NGIT_LOG_LEVEL=INFO \ + -v /tmp/ngit-test/repos:/srv/ngit-relay/repos \ + -v /tmp/ngit-test/blossom:/srv/ngit-relay/blossom \ + -v /tmp/ngit-test/relay-db:/srv/ngit-relay/relay-db \ + -v /tmp/ngit-test/logs:/var/log/ngit-relay \ + ghcr.io/danconwaydev/ngit-relay:latest + +echo "โณ Waiting for relay to start..." +sleep 3 + +echo "๐Ÿงช Running tests..." +echo "" +echo "Note: ngit-relay only accepts Git-related events (NIP-34)." +echo "Some NIP-01 smoke tests will fail (expected behavior)." +echo "Validation tests should pass." +echo "" +RELAY_URL=ws://localhost:8082 cargo test --lib -- --ignored --nocapture + +echo "๐Ÿ›‘ Stopping relay..." +docker stop ngit-relay-test + +echo "๐Ÿงน Cleaning up..." +docker run --rm -v /tmp/ngit-test:/data alpine sh -c "rm -rf /data/*" 2>/dev/null || true + +echo "โœ… Done!" -- cgit v1.2.3