diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2025-11-04 21:58:23 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2025-11-04 21:58:23 +0000 |
| commit | 652c5913f695ba7e8dfd78cd0cbe5cc3de67fa59 (patch) | |
| tree | e76bc0bcdc9eeec466ddf6e5e75a7f63a9d6650e /README.md | |
| parent | c2c0cdba4af434043f3fa707231d8f5a7e3fd882 (diff) | |
test: migrate to TestRelay fixture pattern and add compliance docs
- Remove unnecessary 'nix' dev dependency (Unix syscalls crate, not needed)
- Migrate announcement tests to new TestRelay fixture pattern
- Delete legacy test files (announcement_tests.rs, test_relay.sh)
- Add comprehensive test documentation (docs/how-to/test-compliance.md)
- Update README.md with new test commands
- All 18 integration tests passing (NIP-01 + NIP-34)
Benefits:
- Automatic relay lifecycle management
- No manual setup required
- Pure Rust integration tests
- Better developer experience
- CI/CD ready
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 33 |
1 files changed, 20 insertions, 13 deletions
| @@ -129,17 +129,28 @@ We have two test suites: | |||
| 129 | # Run unit tests (no external dependencies) | 129 | # Run unit tests (no external dependencies) |
| 130 | nix develop -c cargo test --lib | 130 | nix develop -c cargo test --lib |
| 131 | 131 | ||
| 132 | # Run integration tests (tests our relay implementation) | 132 | # Run all integration tests (automatic relay management) |
| 133 | # First, start ngit-grasp relay in one terminal: | 133 | nix develop -c cargo test --test nip01_compliance --test nip34_announcements |
| 134 | NGIT_BIND_ADDRESS=127.0.0.1:7000 nix develop -c cargo run | ||
| 135 | 134 | ||
| 136 | # Then in another terminal, run integration tests: | 135 | # Run NIP-01 compliance tests |
| 137 | nix develop -c cargo test --test announcement_tests --ignored | 136 | nix develop -c cargo test --test nip01_compliance |
| 138 | 137 | ||
| 139 | # Or use the test script (starts relay automatically): | 138 | # Run NIP-34 announcement tests |
| 140 | ./test_relay.sh | 139 | nix develop -c cargo test --test nip34_announcements |
| 140 | |||
| 141 | # With detailed output | ||
| 142 | nix develop -c cargo test --test nip01_compliance -- --nocapture | ||
| 143 | |||
| 144 | # Run specific test | ||
| 145 | nix develop -c cargo test --test nip01_compliance test_nip01_smoke | ||
| 141 | ``` | 146 | ``` |
| 142 | 147 | ||
| 148 | **Integration tests automatically:** | ||
| 149 | - Start a fresh relay instance | ||
| 150 | - Run compliance tests using grasp-audit library | ||
| 151 | - Clean up when done | ||
| 152 | - No manual relay management needed! | ||
| 153 | |||
| 143 | **2. GRASP Audit Tool (grasp-audit)** | 154 | **2. GRASP Audit Tool (grasp-audit)** |
| 144 | 155 | ||
| 145 | The audit tool tests GRASP compliance of any relay (including ours or external ones). | 156 | The audit tool tests GRASP compliance of any relay (including ours or external ones). |
| @@ -151,12 +162,8 @@ cd grasp-audit | |||
| 151 | # Run unit tests | 162 | # Run unit tests |
| 152 | nix develop -c cargo test | 163 | nix develop -c cargo test |
| 153 | 164 | ||
| 154 | # Test against our ngit-grasp relay: | 165 | # Test against any relay (including external ones) |
| 155 | # First, start ngit-grasp (in another terminal): | 166 | nix develop -c cargo run -- --url wss://relay.example.com |
| 156 | cd .. && NGIT_BIND_ADDRESS=127.0.0.1:7000 nix develop -c cargo run | ||
| 157 | |||
| 158 | # Then run audit: | ||
| 159 | nix develop -c cargo run -- --url ws://127.0.0.1:7000 | ||
| 160 | 167 | ||
| 161 | # Or test against any external relay: | 168 | # Or test against any external relay: |
| 162 | nix develop -c cargo run -- --url wss://relay.example.com | 169 | nix develop -c cargo run -- --url wss://relay.example.com |