Skip to content

Commit

Permalink
fix(iroh): Try to fix flaky test_token_passthrough test (#1419)
Browse files Browse the repository at this point in the history
## Description

This seems to fail often on CI on the emulated platforms when the
machines are busy.  And the failures we see are timeouts.  So very
likely increasing this timeout should help.

Does a few smaller fixes:

- Only bind on localhost instead of exposing us to the world.  Tests
  should not expose themselves to the world.

- Make sure that the receiver dropping is caught in a panic.

## Notes & open questions

## Change checklist

- [x] Self-review.
- [x] ~~Documentation updates if relevant.~~
- [x] Tests if relevant.
  • Loading branch information
flub authored Aug 28, 2023
1 parent 2c6ab29 commit a1d4a4d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions iroh/tests/provide.rs
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,7 @@ async fn test_token_passthrough() -> Result<()> {
let rt = test_runtime();
let expected = b"hello".to_vec();
let (db, hash) = create_test_db([("test", expected.clone())]);
let addr = "0.0.0.0:0".parse().unwrap();
let addr = SocketAddr::from((Ipv4Addr::LOCALHOST, 0));
let node = test_node(db, addr)
.custom_auth_handler(Arc::new(CustomAuthHandler))
.runtime(&rt)
Expand All @@ -894,7 +894,7 @@ async fn test_token_passthrough() -> Result<()> {
if let iroh_bytes::provider::Event::GetRequestReceived { token: tok, .. } =
bp_msg
{
events_sender.send(tok).ok();
events_sender.send(tok).expect("receiver dropped");
}
}
}
Expand All @@ -905,7 +905,7 @@ async fn test_token_passthrough() -> Result<()> {

let addrs = node.local_endpoint_addresses().await?;
let peer_id = node.peer_id();
tokio::time::timeout(Duration::from_secs(10), async move {
tokio::time::timeout(Duration::from_secs(30), async move {
let endpoint = MagicEndpoint::builder()
.secret_key(SecretKey::generate())
.keylog(true)
Expand Down

0 comments on commit a1d4a4d

Please sign in to comment.