Skip to content

Commit

Permalink
Add unit test for undeclare deadlock
Browse files Browse the repository at this point in the history
  • Loading branch information
oteffahi committed Dec 10, 2024
1 parent 80a740f commit f90245a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions zenoh/tests/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -430,3 +430,15 @@ async fn zenoh_session_close_in_background() {
};
ztimeout!(close_all);
}

#[cfg(feature = "unstable")]
#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
async fn test_undeclare_subscribers_same_keyexpr() {
let key_expr = "test/undeclare/subscribers";
let session = zenoh::open(zenoh::Config::default()).await.unwrap();
let sub1 = session.declare_subscriber(key_expr).await.unwrap();
let sub2 = session.declare_subscriber(key_expr).await.unwrap();
tokio::time::sleep(SLEEP).await;
ztimeout!(sub1.undeclare()).unwrap();
ztimeout!(sub2.undeclare()).unwrap();
}

0 comments on commit f90245a

Please sign in to comment.