Skip to content

Commit

Permalink
test dings
Browse files Browse the repository at this point in the history
Signed-off-by: Brian L. Troutwine <brian@troutwine.us>
  • Loading branch information
blt committed Feb 8, 2022
1 parent 7bda1c7 commit 1a45458
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/topology/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::{
time::Instant,
};

use futures::{stream::FuturesOrdered, FutureExt, StreamExt, TryFutureExt};
use futures::{stream::FuturesOrdered, FutureExt, StreamExt};
use once_cell::sync::Lazy;
use stream_cancel::{StreamExt as StreamCancelExt, Trigger, Tripwire};
use tokio::{
Expand Down
17 changes: 13 additions & 4 deletions src/topology/test/backpressure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ async fn serial_backpressure() {

let sourced_events = source_counter.load(Ordering::Relaxed);

assert_eq!(sourced_events, expected_sourced_events);
assert!(
sourced_events >= expected_sourced_events && sourced_events < expected_sourced_events * 2
);
}

/// Connects a single source to two sinks and makes sure that the source is only able
Expand Down Expand Up @@ -96,7 +98,9 @@ async fn default_fan_out() {

let sourced_events = source_counter.load(Ordering::Relaxed);

assert_eq!(sourced_events, expected_sourced_events);
assert!(
sourced_events >= expected_sourced_events && sourced_events < expected_sourced_events * 2
);
}

/// Connects a single source to two sinks. One of the sinks is configured to drop events that exceed
Expand Down Expand Up @@ -149,7 +153,9 @@ async fn buffer_drop_fan_out() {

let sourced_events = source_counter.load(Ordering::Relaxed);

assert_eq!(sourced_events, expected_sourced_events);
assert!(
sourced_events >= expected_sourced_events && sourced_events < expected_sourced_events * 2
);
}

/// Connects 2 sources to a single sink, and asserts that the sum of the events produced
Expand Down Expand Up @@ -196,7 +202,10 @@ async fn multiple_inputs_backpressure() {
let sourced_events_2 = source_counter_2.load(Ordering::Relaxed);
let sourced_events_sum = sourced_events_1 + sourced_events_2;

assert_eq!(sourced_events_sum, expected_sourced_events);
assert!(
sourced_events_sum >= expected_sourced_events
&& sourced_events_sum < expected_sourced_events * 2
);
}

mod test_sink {
Expand Down

0 comments on commit 1a45458

Please sign in to comment.