diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2025-11-05 07:03:04 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2025-11-05 07:03:04 +0000 |
| commit | 74c7b090a6ec7f749a3a79dcb0c9a0a6bc198702 (patch) | |
| tree | cfb3a0b6ac170ff54a7f82cfd0472ecbfe1206cf /grasp-audit/test-ngit-relay.sh | |
| parent | 5cd47079ee762125817612d2bf82a0bca07da3ad (diff) | |
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.
Diffstat (limited to 'grasp-audit/test-ngit-relay.sh')
| -rwxr-xr-x | grasp-audit/test-ngit-relay.sh | 46 |
1 files changed, 46 insertions, 0 deletions
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 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | set -e | ||
| 3 | |||
| 4 | echo "๐งน Cleaning up old test data..." | ||
| 5 | # Use docker to cleanup with proper permissions | ||
| 6 | docker run --rm -v /tmp/ngit-test:/data alpine sh -c "rm -rf /data/*" 2>/dev/null || true | ||
| 7 | mkdir -p /tmp/ngit-test/{repos,blossom,relay-db,logs} | ||
| 8 | |||
| 9 | echo "๐ Starting ngit-relay..." | ||
| 10 | # Remove any existing container with this name | ||
| 11 | docker rm -f ngit-relay-test 2>/dev/null || true | ||
| 12 | docker run --rm -d \ | ||
| 13 | --name ngit-relay-test \ | ||
| 14 | -p 8082:8081 \ | ||
| 15 | -e NGIT_DOMAIN=localhost \ | ||
| 16 | -e NGIT_RELAY_NAME="ngit-relay test instance" \ | ||
| 17 | -e NGIT_RELAY_DESCRIPTION="Test instance for grasp-audit" \ | ||
| 18 | -e NGIT_OWNER_NPUB="npub15qydau2hjma6ngxkl2cyar74wzyjshvl65za5k5rl69264ar2exs5cyejr" \ | ||
| 19 | -e NGIT_PROACTIVE_SYNC_GIT=false \ | ||
| 20 | -e NGIT_PROACTIVE_SYNC_BLOSSOM=false \ | ||
| 21 | -e NGIT_PROACTIVE_SYNC_NOSTR=false \ | ||
| 22 | -e NGIT_LOG_LEVEL=INFO \ | ||
| 23 | -v /tmp/ngit-test/repos:/srv/ngit-relay/repos \ | ||
| 24 | -v /tmp/ngit-test/blossom:/srv/ngit-relay/blossom \ | ||
| 25 | -v /tmp/ngit-test/relay-db:/srv/ngit-relay/relay-db \ | ||
| 26 | -v /tmp/ngit-test/logs:/var/log/ngit-relay \ | ||
| 27 | ghcr.io/danconwaydev/ngit-relay:latest | ||
| 28 | |||
| 29 | echo "โณ Waiting for relay to start..." | ||
| 30 | sleep 3 | ||
| 31 | |||
| 32 | echo "๐งช Running tests..." | ||
| 33 | echo "" | ||
| 34 | echo "Note: ngit-relay only accepts Git-related events (NIP-34)." | ||
| 35 | echo "Some NIP-01 smoke tests will fail (expected behavior)." | ||
| 36 | echo "Validation tests should pass." | ||
| 37 | echo "" | ||
| 38 | RELAY_URL=ws://localhost:8082 cargo test --lib -- --ignored --nocapture | ||
| 39 | |||
| 40 | echo "๐ Stopping relay..." | ||
| 41 | docker stop ngit-relay-test | ||
| 42 | |||
| 43 | echo "๐งน Cleaning up..." | ||
| 44 | docker run --rm -v /tmp/ngit-test:/data alpine sh -c "rm -rf /data/*" 2>/dev/null || true | ||
| 45 | |||
| 46 | echo "โ Done!" | ||