Skip to content

Commit

Permalink
iox-#5 Add tests for loaning but not publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
elBoberido committed Jun 30, 2022
1 parent 75ea0dc commit 23bd549
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/tests/basic_pub_sub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,30 @@ fn multi_threaded_subscriber() -> Result<()> {

Ok(())
}

#[test]
fn publisher_loaning_but_not_publishing_sample() -> Result<()> {
let _roudi = RouDiEnvironment::new();

Runtime::init("basic_pub_sub");

let (subscriber, sample_receive_token) =
SubscriberBuilder::<Counter>::new("Test", "BasicPubSub", "Counter")
.queue_capacity(5)
.create()?;

let publisher = PublisherBuilder::<Counter>::new("Test", "BasicPubSub", "Counter").create()?;

{
let _sample = publisher.loan()?;
}

let sample_receiver = subscriber.get_sample_receiver(sample_receive_token);

assert!(!sample_receiver.has_data());

publisher.stop_offer();
subscriber.unsubscribe(sample_receiver);

Ok(())
}

0 comments on commit 23bd549

Please sign in to comment.