Skip to content

Commit

Permalink
test: add minimal shutdown test
Browse files Browse the repository at this point in the history
  • Loading branch information
dignifiedquire committed Nov 29, 2024
1 parent aaa2d69 commit 212c781
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions iroh/src/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,3 +376,24 @@ async fn handle_connection(incoming: crate::endpoint::Incoming, protocols: Arc<P
warn!("Handling incoming connection ended with error: {err}");
}
}

#[cfg(test)]
mod tests {
use super::*;

#[tokio::test]
async fn test_shutdown() -> Result<()> {
let endpoint = Endpoint::builder().bind().await?;
let router = Router::builder(endpoint.clone()).spawn().await?;

assert!(!router.is_shutdown());
assert!(!endpoint.is_closed());

router.shutdown().await?;

assert!(router.is_shutdown());
assert!(endpoint.is_closed());

Ok(())
}
}

0 comments on commit 212c781

Please sign in to comment.