diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2025-11-05 12:46:02 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2025-11-05 12:46:02 +0000 |
| commit | 94bf5c39af0d8d0a9a15db240d5d46383ec22160 (patch) | |
| tree | 08f92f780d066c80d271694bfc16bbfcc0dc1bae | |
| parent | 6b78ed707a69e22e5fadd5bd0999c16a0931bbaa (diff) | |
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
| -rw-r--r-- | AGENTS.md | 13 | ||||
| -rw-r--r-- | grasp-audit/README.md | 5 | ||||
| -rwxr-xr-x | grasp-audit/test-ngit-relay.sh | 7 |
3 files changed, 19 insertions, 6 deletions
| @@ -37,6 +37,10 @@ nix-shell --run "cargo build" | |||
| 37 | docker run --rm -p 18081:8081 ghcr.io/danconwaydev/ngit-relay:latest | 37 | docker run --rm -p 18081:8081 ghcr.io/danconwaydev/ngit-relay:latest |
| 38 | 38 | ||
| 39 | # From grasp-audit directory, set RELAY_URL to match your port | 39 | # From grasp-audit directory, set RELAY_URL to match your port |
| 40 | # Run all ignored tests (includes GRASP-01 and other relay-dependent tests) | ||
| 41 | RELAY_URL="ws://localhost:18081" nix develop -c cargo test --lib -- --ignored --nocapture | ||
| 42 | |||
| 43 | # Or run a specific test | ||
| 40 | RELAY_URL="ws://localhost:18081" nix develop -c cargo test --lib test_grasp01_nostr_relay_against_relay -- --ignored --nocapture | 44 | RELAY_URL="ws://localhost:18081" nix develop -c cargo test --lib test_grasp01_nostr_relay_against_relay -- --ignored --nocapture |
| 41 | ``` | 45 | ``` |
| 42 | 46 | ||
| @@ -89,12 +93,16 @@ nix develop -c cargo test --lib specific_test_name -- --nocapture | |||
| 89 | To verify GRASP-01 compliance tests are working correctly: | 93 | To verify GRASP-01 compliance tests are working correctly: |
| 90 | 94 | ||
| 91 | ```bash | 95 | ```bash |
| 96 | # Run all ignored library tests (includes GRASP-01) | ||
| 97 | cd grasp-audit && RELAY_URL="ws://localhost:18081" nix develop -c cargo test --lib -- --ignored --nocapture 2>&1 | tail -60 | ||
| 98 | |||
| 99 | # Or run specific GRASP-01 test | ||
| 92 | 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 | 100 | 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 |
| 93 | ``` | 101 | ``` |
| 94 | 102 | ||
| 95 | **Expected Output:** | 103 | **Expected Output:** |
| 96 | - 2-3 tests passing | 104 | - 2-3 tests passing |
| 97 | - 15 tests showing "Not implemented yet" | 105 | - 15+ tests showing "Not implemented yet" |
| 98 | 106 | ||
| 99 | ### Troubleshooting | 107 | ### Troubleshooting |
| 100 | 108 | ||
| @@ -194,7 +202,8 @@ cd grasp-audit && nix develop -c cargo build | |||
| 194 | 202 | ||
| 195 | # Manual relay testing (if needed) | 203 | # Manual relay testing (if needed) |
| 196 | # 1. Start relay: docker run --rm -p 18081:8081 ghcr.io/danconwaydev/ngit-relay:latest | 204 | # 1. Start relay: docker run --rm -p 18081:8081 ghcr.io/danconwaydev/ngit-relay:latest |
| 197 | # 2. Run tests: RELAY_URL="ws://localhost:18081" nix develop -c cargo test --ignored | 205 | # 2. Run all ignored tests: RELAY_URL="ws://localhost:18081" nix develop -c cargo test --lib -- --ignored --nocapture |
| 206 | # 3. Or specific test: RELAY_URL="ws://localhost:18081" nix develop -c cargo test --lib test_grasp01_nostr_relay_against_relay -- --ignored --nocapture | ||
| 198 | 207 | ||
| 199 | # Run single test | 208 | # Run single test |
| 200 | cd grasp-audit && nix develop -c cargo test --lib test_name -- --nocapture | 209 | 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 | |||
| 178 | # In another terminal, run tests with RELAY_URL | 178 | # In another terminal, run tests with RELAY_URL |
| 179 | grasp-audit audit --relay ws://localhost:18081 --mode ci | 179 | grasp-audit audit --relay ws://localhost:18081 --mode ci |
| 180 | 180 | ||
| 181 | # or specific test via cargo | 181 | # or run all ignored tests via cargo |
| 182 | RELAY_URL="ws://localhost:18081" cargo test --lib -- --ignored --nocapture | ||
| 183 | |||
| 184 | # or run specific test via cargo | ||
| 182 | RELAY_URL="ws://localhost:18081" cargo test --lib test_grasp01_nostr_relay_against_relay -- --ignored --nocapture | 185 | RELAY_URL="ws://localhost:18081" cargo test --lib test_grasp01_nostr_relay_against_relay -- --ignored --nocapture |
| 183 | ``` | 186 | ``` |
| 184 | 187 | ||
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 | |||
| 195 | # Run cargo test suite | 195 | # Run cargo test suite |
| 196 | # - RELAY_URL: Environment variable tests use to connect | 196 | # - RELAY_URL: Environment variable tests use to connect |
| 197 | # - --lib: Only library tests (not integration tests in tests/) | 197 | # - --lib: Only library tests (not integration tests in tests/) |
| 198 | # - test_grasp01_nostr_relay_against_relay: Specific test module | ||
| 199 | # - --ignored: Run tests marked with #[ignore] (these need relay) | 198 | # - --ignored: Run tests marked with #[ignore] (these need relay) |
| 200 | # - --nocapture: Show println! output from tests | 199 | # - --nocapture: Show println! output from tests |
| 200 | # This runs all library tests marked with #[ignore], including: | ||
| 201 | # - test_grasp01_nostr_relay_against_relay (GRASP-01 relay tests) | ||
| 202 | # - Any other integration tests requiring a relay | ||
| 201 | RELAY_URL="ws://localhost:$PORT" cargo test \ | 203 | RELAY_URL="ws://localhost:$PORT" cargo test \ |
| 202 | --lib test_grasp01_nostr_relay_against_relay \ | 204 | --lib -- --ignored --nocapture || { |
| 203 | -- --ignored --nocapture || { | ||
| 204 | echo "⚠️ Some tests failed" | 205 | echo "⚠️ Some tests failed" |
| 205 | echo " Review output above for details" | 206 | echo " Review output above for details" |
| 206 | } | 207 | } |