From 94bf5c39af0d8d0a9a15db240d5d46383ec22160 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Wed, 5 Nov 2025 12:46:02 +0000 Subject: Fix cargo test invocation in test-ngit-relay.sh and documentation - Changed from 'cargo test --lib test_grasp01_nostr_relay_against_relay' to 'cargo test --lib -- --ignored --nocapture' - This correctly runs ALL library tests marked with #[ignore], not just GRASP-01 - Updated AGENTS.md and grasp-audit/README.md with correct commands - Added examples showing both 'run all ignored tests' and 'run specific test' patterns --- AGENTS.md | 13 +++++++++++-- grasp-audit/README.md | 5 ++++- grasp-audit/test-ngit-relay.sh | 7 ++++--- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index d00d7fb..4e33b2a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -37,6 +37,10 @@ nix-shell --run "cargo build" docker run --rm -p 18081:8081 ghcr.io/danconwaydev/ngit-relay:latest # From grasp-audit directory, set RELAY_URL to match your port +# Run all ignored tests (includes GRASP-01 and other relay-dependent tests) +RELAY_URL="ws://localhost:18081" nix develop -c cargo test --lib -- --ignored --nocapture + +# Or run a specific test RELAY_URL="ws://localhost:18081" nix develop -c cargo test --lib test_grasp01_nostr_relay_against_relay -- --ignored --nocapture ``` @@ -89,12 +93,16 @@ nix develop -c cargo test --lib specific_test_name -- --nocapture To verify GRASP-01 compliance tests are working correctly: ```bash +# Run all ignored library tests (includes GRASP-01) +cd grasp-audit && RELAY_URL="ws://localhost:18081" nix develop -c cargo test --lib -- --ignored --nocapture 2>&1 | tail -60 + +# Or run specific GRASP-01 test cd grasp-audit && RELAY_URL="ws://localhost:18081" nix develop -c cargo test --lib test_grasp01_nostr_relay_against_relay -- --ignored --nocapture 2>&1 | tail -60 ``` **Expected Output:** - 2-3 tests passing -- 15 tests showing "Not implemented yet" +- 15+ tests showing "Not implemented yet" ### Troubleshooting @@ -194,7 +202,8 @@ cd grasp-audit && nix develop -c cargo build # Manual relay testing (if needed) # 1. Start relay: docker run --rm -p 18081:8081 ghcr.io/danconwaydev/ngit-relay:latest -# 2. Run tests: RELAY_URL="ws://localhost:18081" nix develop -c cargo test --ignored +# 2. Run all ignored tests: RELAY_URL="ws://localhost:18081" nix develop -c cargo test --lib -- --ignored --nocapture +# 3. Or specific test: RELAY_URL="ws://localhost:18081" nix develop -c cargo test --lib test_grasp01_nostr_relay_against_relay -- --ignored --nocapture # Run single test cd grasp-audit && nix develop -c cargo test --lib test_name -- --nocapture diff --git a/grasp-audit/README.md b/grasp-audit/README.md index 97a6429..b1dcb15 100644 --- a/grasp-audit/README.md +++ b/grasp-audit/README.md @@ -178,7 +178,10 @@ docker run --rm -p 18081:8081 ghcr.io/danconwaydev/ngit-relay:latest # In another terminal, run tests with RELAY_URL grasp-audit audit --relay ws://localhost:18081 --mode ci -# or specific test via cargo +# or run all ignored tests via cargo +RELAY_URL="ws://localhost:18081" cargo test --lib -- --ignored --nocapture + +# or run specific test via cargo RELAY_URL="ws://localhost:18081" cargo test --lib test_grasp01_nostr_relay_against_relay -- --ignored --nocapture ``` diff --git a/grasp-audit/test-ngit-relay.sh b/grasp-audit/test-ngit-relay.sh index bd4b155..ff6ac1a 100755 --- a/grasp-audit/test-ngit-relay.sh +++ b/grasp-audit/test-ngit-relay.sh @@ -195,12 +195,13 @@ elif [ "$MODE" = "test" ]; then # Run cargo test suite # - RELAY_URL: Environment variable tests use to connect # - --lib: Only library tests (not integration tests in tests/) - # - test_grasp01_nostr_relay_against_relay: Specific test module # - --ignored: Run tests marked with #[ignore] (these need relay) # - --nocapture: Show println! output from tests + # This runs all library tests marked with #[ignore], including: + # - test_grasp01_nostr_relay_against_relay (GRASP-01 relay tests) + # - Any other integration tests requiring a relay RELAY_URL="ws://localhost:$PORT" cargo test \ - --lib test_grasp01_nostr_relay_against_relay \ - -- --ignored --nocapture || { + --lib -- --ignored --nocapture || { echo "⚠️ Some tests failed" echo " Review output above for details" } -- cgit v1.2.3