Skip to content

Commit

Permalink
test(iroh-gossip): Wait for the relay to make gossip_net_smoke fast…
Browse files Browse the repository at this point in the history
…er. (#2663)

## Description

<!-- A summary of what this pull request achieves and a rough list of
changes. -->
Just a tiny change that improves performance from ~1s -> ~0.4s on my
machine.

## Breaking Changes

<!-- Optional, if there are any breaking changes document them,
including how to migrate older code. -->
None

## Notes & open questions

<!-- Any notes, remarks or open questions you have to make about the PR.
-->
One could argue we shouldn't make this change, because it doesn't cause
that much erratic behavior. We should rather write tests that fail on
"more bugs".
I'm not sure. Perhaps the gossip smoke test shouldn't be the test that
we use to stress network edge cases.

## Change checklist

- [x] Self-review.
- ~~[ ] Documentation updates following the [style
guide](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#appendix-a-full-conventions-text),
if relevant.~~
- [x] Tests if relevant.
- [x] All breaking changes documented.
  • Loading branch information
matheus23 committed Aug 23, 2024
1 parent d567231 commit 1d3f3fa
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions iroh-gossip/src/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -840,13 +840,16 @@ mod test {
rng: &mut rand_chacha::ChaCha12Rng,
relay_map: RelayMap,
) -> anyhow::Result<Endpoint> {
Endpoint::builder()
let ep = Endpoint::builder()
.secret_key(SecretKey::generate_with_rng(rng))
.alpns(vec![GOSSIP_ALPN.to_vec()])
.relay_mode(RelayMode::Custom(relay_map))
.insecure_skip_relay_cert_verify(true)
.bind(0)
.await
.await?;

ep.watch_home_relay().next().await;
Ok(ep)
}

async fn endpoint_loop(
Expand Down

0 comments on commit 1d3f3fa

Please sign in to comment.