diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2025-11-04 14:33:18 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2025-11-04 14:33:18 +0000 |
| commit | c2c0cdba4af434043f3fa707231d8f5a7e3fd882 (patch) | |
| tree | 02adae65fba476e5fcdf1fadcd0ce9efa4f1fbcd /README.md | |
| parent | 4d89f4537c325f60571cc6339df0708ee8161514 (diff) | |
add announcement tests
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 70 |
1 files changed, 58 insertions, 12 deletions
| @@ -76,17 +76,22 @@ This approach provides: | |||
| 76 | git clone https://gitworkshop.dev/ngit-grasp | 76 | git clone https://gitworkshop.dev/ngit-grasp |
| 77 | cd ngit-grasp | 77 | cd ngit-grasp |
| 78 | 78 | ||
| 79 | # Build | 79 | # Build (using Nix for reproducible environment) |
| 80 | cargo build --release | 80 | nix develop -c cargo build --release |
| 81 | 81 | ||
| 82 | # Configure | 82 | # Configure |
| 83 | cp .env.example .env | 83 | cp .env.example .env |
| 84 | # Edit .env with your settings | 84 | # Edit .env with your settings |
| 85 | 85 | ||
| 86 | # Run | 86 | # Run |
| 87 | cargo run --release | 87 | nix develop -c cargo run --release |
| 88 | |||
| 89 | # Run tests | ||
| 90 | nix develop -c cargo test --lib | ||
| 88 | ``` | 91 | ``` |
| 89 | 92 | ||
| 93 | **Don't have Nix?** See [Getting Started Tutorial](docs/tutorials/getting-started.md) for alternative setup methods. | ||
| 94 | |||
| 90 | ## Configuration | 95 | ## Configuration |
| 91 | 96 | ||
| 92 | Environment variables (see `.env.example`): | 97 | Environment variables (see `.env.example`): |
| @@ -114,24 +119,65 @@ We use the **[Diátaxis](https://diataxis.fr/)** framework for documentation: | |||
| 114 | 119 | ||
| 115 | See [Architecture Overview](docs/explanation/architecture.md) for system design and [Test Strategy](docs/reference/test-strategy.md) for testing approach. | 120 | See [Architecture Overview](docs/explanation/architecture.md) for system design and [Test Strategy](docs/reference/test-strategy.md) for testing approach. |
| 116 | 121 | ||
| 122 | ### Running Tests | ||
| 123 | |||
| 124 | We have two test suites: | ||
| 125 | |||
| 126 | **1. Main Project Tests (ngit-grasp)** | ||
| 127 | |||
| 117 | ```bash | 128 | ```bash |
| 118 | # Run tests | 129 | # Run unit tests (no external dependencies) |
| 119 | cargo test | 130 | nix develop -c cargo test --lib |
| 131 | |||
| 132 | # Run integration tests (tests our relay implementation) | ||
| 133 | # First, start ngit-grasp relay in one terminal: | ||
| 134 | NGIT_BIND_ADDRESS=127.0.0.1:7000 nix develop -c cargo run | ||
| 135 | |||
| 136 | # Then in another terminal, run integration tests: | ||
| 137 | nix develop -c cargo test --test announcement_tests --ignored | ||
| 138 | |||
| 139 | # Or use the test script (starts relay automatically): | ||
| 140 | ./test_relay.sh | ||
| 141 | ``` | ||
| 120 | 142 | ||
| 121 | # Run compliance tests | 143 | **2. GRASP Audit Tool (grasp-audit)** |
| 122 | cargo test --test compliance | ||
| 123 | 144 | ||
| 145 | The audit tool tests GRASP compliance of any relay (including ours or external ones). | ||
| 146 | |||
| 147 | ```bash | ||
| 148 | # Enter grasp-audit directory | ||
| 149 | cd grasp-audit | ||
| 150 | |||
| 151 | # Run unit tests | ||
| 152 | nix develop -c cargo test | ||
| 153 | |||
| 154 | # Test against our ngit-grasp relay: | ||
| 155 | # First, start ngit-grasp (in another terminal): | ||
| 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 | |||
| 161 | # Or test against any external relay: | ||
| 162 | nix develop -c cargo run -- --url wss://relay.example.com | ||
| 163 | ``` | ||
| 164 | |||
| 165 | ### Development Commands | ||
| 166 | |||
| 167 | ```bash | ||
| 124 | # Run with logging | 168 | # Run with logging |
| 125 | RUST_LOG=debug cargo run | 169 | RUST_LOG=debug nix develop -c cargo run |
| 126 | 170 | ||
| 127 | # Check code | 171 | # Check code |
| 128 | cargo clippy | 172 | nix develop -c cargo clippy |
| 129 | cargo fmt --check | 173 | nix develop -c cargo fmt --check |
| 130 | 174 | ||
| 131 | # Generate test coverage | 175 | # Generate test coverage (requires tarpaulin) |
| 132 | cargo tarpaulin --out Html | 176 | nix develop -c cargo tarpaulin --out Html |
| 133 | ``` | 177 | ``` |
| 134 | 178 | ||
| 179 | **Note:** Always use `nix develop` to ensure the correct build environment. See [docs/how-to/nix-flakes.md](docs/how-to/nix-flakes.md) for details. | ||
| 180 | |||
| 135 | ## Project Structure | 181 | ## Project Structure |
| 136 | 182 | ||
| 137 | ``` | 183 | ``` |