diff --git a/tests/connection_actor.rs b/tests/connection_actor.rs index 6d9a0c80..e4095fc4 100644 --- a/tests/connection_actor.rs +++ b/tests/connection_actor.rs @@ -68,6 +68,39 @@ async fn fairness_yields_low_after_burst( assert_eq!(out, vec![1, 2, 99, 3, 4, 5]); } +#[rstest] +#[tokio::test] +async fn fairness_disabled_processes_all_high_first( + queues: (PushQueues, wireframe::push::PushHandle), + shutdown_token: CancellationToken, +) { + let (queues, handle) = queues; + let fairness = FairnessConfig { + max_high_before_low: 0, + time_slice: None, + }; + + for n in 1..=3 { + let message = format!("failed to push high-priority frame {n}"); + handle.push_high_priority(n).await.expect(&message); + } + handle + .push_low_priority(4) + .await + .expect("failed to push low-priority frame 4"); + handle + .push_low_priority(5) + .await + .expect("failed to push low-priority frame 5"); + + let mut actor: ConnectionActor<_, ()> = + ConnectionActor::new(queues, handle, None, shutdown_token); + actor.set_fairness(fairness); + let mut out = Vec::new(); + actor.run(&mut out).await.expect("actor run failed"); + assert_eq!(out, vec![1, 2, 3, 4, 5]); +} + #[rstest] #[tokio::test] async fn shutdown_signal_precedence(