Skip to content

Commit d2557fe

Browse files
authored
docs: update test network guidance (#2057)
1 parent d9761dc commit d2557fe

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

AGENTS.md

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,24 @@ Run these in any worktree before pushing a branch or opening a PR.
4141
- The repository uses the special `TODO-` `MUST-FIX` marker to block commits that temporarily disable tests. If a test must be skipped, leave a `// TODO-` `MUST-FIX:` comment explaining why and create a follow-up issue.
4242
- Never remove or ignore failing tests without understanding the root cause.
4343

44-
### Gateway Test Framework
45-
Integration testing is performed with the `freenet-testing-tools` repository (specifically `gateway-testing/`):
46-
```bash
47-
python gateway_test_framework.py --local # Smoke test against local build
48-
python gateway_test_framework.py --version v0.1.19 # Regression against a release
49-
python gateway_test_framework.py --version pr:123 # Validate a pull request
50-
```
51-
Results land in `gateway-testing/results/<user>/<date>/` and include markdown summaries and compressed logs. Use the `--extended-stability`, `--multi-room`, or `--debug-locations` flags for deeper investigations.
44+
### Integration Testing with `freenet-test-network`
45+
- Use the `freenet-test-network` crate located at `~/code/freenet/freenet-test-network` to spin up gateways and peers for integration tests.
46+
- Add it as a dev-dependency in your worktree (`freenet-test-network = { path = "../freenet-test-network" }`) and construct networks with the builder API.
47+
- Sample pattern:
48+
```rust
49+
use freenet_test_network::TestNetwork;
50+
use std::sync::LazyLock;
51+
52+
static NETWORK: LazyLock<TestNetwork> = LazyLock::new(|| {
53+
TestNetwork::builder()
54+
.gateways(1)
55+
.peers(5)
56+
.build_sync()
57+
.expect("start test network")
58+
});
59+
```
60+
- Tests can share the static network and access `NETWORK.gateway(0).ws_url()` to communicate via `freenet_stdlib::client_api::WebApi`.
61+
- Run the crate’s suite with `cargo test -p freenet-test-network`. When `preserve_temp_dirs_on_failure(true)` is set, failing startups keep logs under `/tmp/freenet-test-network-<timestamp>/` for inspection.
5262

5363
## Pull Requests & Reviews
5464
- All PR titles must follow Conventional Commits (`feat:`, `fix:`, `docs:`, etc.). CI fails non-conforming titles.

0 commit comments

Comments
 (0)