diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2025-11-05 11:05:53 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2025-11-05 11:09:21 +0000 |
| commit | ff00d106da0abd734a233e6445cdd81ffb5f1d9f (patch) | |
| tree | eb9b5b552e653104c63c29b250670628d21dd368 | |
| parent | 86077d24e7cc8ff9d474a5947f0151d005f9f747 (diff) | |
docs: fixed desired grasp-audit behaviour in README.md
| -rw-r--r-- | grasp-audit/README.md | 36 | ||||
| -rw-r--r-- | grasp-audit/src/specs/grasp01_nostr_relay.rs | 5 |
2 files changed, 12 insertions, 29 deletions
diff --git a/grasp-audit/README.md b/grasp-audit/README.md index b73d72b..3787fee 100644 --- a/grasp-audit/README.md +++ b/grasp-audit/README.md | |||
| @@ -44,8 +44,8 @@ cargo install --path . | |||
| 44 | # Run smoke tests against local relay | 44 | # Run smoke tests against local relay |
| 45 | grasp-audit audit --relay ws://localhost:7000 --mode ci --spec nip01-smoke | 45 | grasp-audit audit --relay ws://localhost:7000 --mode ci --spec nip01-smoke |
| 46 | 46 | ||
| 47 | # Audit production server (read-only) | 47 | # Audit production server |
| 48 | grasp-audit audit --relay wss://relay.example.com --mode production --spec all | 48 | grasp-audit audit --relay wss://grasp.example.com --mode production --spec all |
| 49 | ``` | 49 | ``` |
| 50 | 50 | ||
| 51 | ## Test Specifications | 51 | ## Test Specifications |
| @@ -77,9 +77,9 @@ All audit events include special tags: | |||
| 77 | ```json | 77 | ```json |
| 78 | { | 78 | { |
| 79 | "tags": [ | 79 | "tags": [ |
| 80 | ["grasp-audit", "true"], | 80 | ["t", "grasp-audit"], |
| 81 | ["audit-run-id", "ci-a1b2c3d4-e5f6-7890-abcd-ef1234567890"], | 81 | ["r", "audit-run-id-ci-a1b2c3d4-e5f6-7890-abcd-ef1234567890"], |
| 82 | ["audit-cleanup", "2025-11-03T12:00:00Z"] | 82 | ["r", "audit-cleanup-2025-11-03T12:00:00Z"] |
| 83 | ] | 83 | ] |
| 84 | } | 84 | } |
| 85 | ``` | 85 | ``` |
| @@ -134,7 +134,7 @@ nix develop | |||
| 134 | cargo test | 134 | cargo test |
| 135 | ``` | 135 | ``` |
| 136 | 136 | ||
| 137 | ### Integration Tests Against ngit-relay | 137 | ### Integration Tests Against ngit-relay docker image |
| 138 | 138 | ||
| 139 | Test against the reference GRASP implementation to ensure compatibility. | 139 | Test against the reference GRASP implementation to ensure compatibility. |
| 140 | 140 | ||
| @@ -151,31 +151,15 @@ See `test-ngit-relay.sh` for full setup/cleanup details. | |||
| 151 | 151 | ||
| 152 | ```bash | 152 | ```bash |
| 153 | # Start relay on a specific port (example uses 18081) | 153 | # Start relay on a specific port (example uses 18081) |
| 154 | docker run --rm -p 18081:8081 -e NGIT_BIND_ADDRESS=0.0.0.0:8081 ghcr.io/danconwaydev/ngit-relay:latest | 154 | docker run --rm -p 18081:8081 ghcr.io/danconwaydev/ngit-relay:latest |
| 155 | 155 | ||
| 156 | # In another terminal, run tests with RELAY_URL | 156 | # In another terminal, run tests with RELAY_URL |
| 157 | RELAY_URL="ws://localhost:18081" cargo test --lib test_grasp01_nostr_relay_against_relay -- --ignored --nocapture | 157 | grasp-audit audit --relay ws://localhost:18081 --mode ci |
| 158 | ``` | ||
| 159 | |||
| 160 | **Note:** ngit-relay only accepts Git-related events (NIP-34). Some NIP-01 smoke tests will fail (expected). Validation tests should pass. | ||
| 161 | |||
| 162 | ### Testing Against General-Purpose Relays | ||
| 163 | |||
| 164 | For full NIP-01 smoke test coverage (all 6 tests passing), test against a general-purpose relay: | ||
| 165 | 158 | ||
| 166 | ```bash | 159 | # or specific test via cargo |
| 167 | # Start nostr-rs-relay (accepts all event kinds) | 160 | RELAY_URL="ws://localhost:18081" cargo test --lib test_grasp01_nostr_relay_against_relay -- --ignored --nocapture |
| 168 | docker run --rm -d --name nostr-test-relay -p 7000:8080 scsibug/nostr-rs-relay | ||
| 169 | |||
| 170 | # Run tests (all should pass) | ||
| 171 | cargo test --lib -- --ignored --nocapture | ||
| 172 | |||
| 173 | # Cleanup | ||
| 174 | docker stop nostr-test-relay | ||
| 175 | ``` | 161 | ``` |
| 176 | 162 | ||
| 177 | Expected: 6/6 tests passed (100%) | ||
| 178 | |||
| 179 | ## Architecture | 163 | ## Architecture |
| 180 | 164 | ||
| 181 | ``` | 165 | ``` |
diff --git a/grasp-audit/src/specs/grasp01_nostr_relay.rs b/grasp-audit/src/specs/grasp01_nostr_relay.rs index ca84a4b..7c4ef1e 100644 --- a/grasp-audit/src/specs/grasp01_nostr_relay.rs +++ b/grasp-audit/src/specs/grasp01_nostr_relay.rs | |||
| @@ -653,9 +653,8 @@ mod tests { | |||
| 653 | #[tokio::test] | 653 | #[tokio::test] |
| 654 | #[ignore] // Requires running relay | 654 | #[ignore] // Requires running relay |
| 655 | async fn test_grasp01_nostr_relay_against_relay() { | 655 | async fn test_grasp01_nostr_relay_against_relay() { |
| 656 | // Read relay URL from environment variable, default to localhost:8081 | 656 | // Read relay URL from environment variable - must be supplied |
| 657 | let relay_url = std::env::var("RELAY_URL") | 657 | let relay_url = std::env::var("RELAY_URL")?; |
| 658 | .unwrap_or_else(|_| "ws://localhost:8081".to_string()); | ||
| 659 | 658 | ||
| 660 | let config = AuditConfig::ci(); | 659 | let config = AuditConfig::ci(); |
| 661 | let client = AuditClient::new(&relay_url, config) | 660 | let client = AuditClient::new(&relay_url, config) |