()
| 374 | |
| 375 | #[test] |
| 376 | fn backpressure_thresholds_per_virtual_queue() { |
| 377 | let mut wfq: WeightedFairQueue<u32> = WeightedFairQueue::new(8, 100); |
| 378 | wfq.set_priority(1, PriorityClass::Standard); |
| 379 | wfq.set_priority(2, PriorityClass::Standard); |
| 380 | |
| 381 | // Fair share = 8 / 2 = 4 per DB. |
| 382 | // Push 3 items into DB 1 → 3/4 = 75% → not throttled. |
| 383 | for _ in 0..3 { |
| 384 | wfq.try_enqueue(1, 0).unwrap(); |
| 385 | } |
| 386 | assert!(!wfq.is_throttled_for(1)); |
| 387 | assert!(!wfq.is_suspended_for(1)); |
| 388 | |
| 389 | // Push 1 more → 4/4 = 100% → throttled AND suspended. |
| 390 | wfq.try_enqueue(1, 0).unwrap(); |
| 391 | assert!(wfq.is_throttled_for(1)); |
| 392 | assert!(wfq.is_suspended_for(1)); |
| 393 | |
| 394 | // DB 2 is untouched → not throttled. |
| 395 | assert!(!wfq.is_throttled_for(2)); |
| 396 | } |
| 397 | } |
nothing calls this directly
no test coverage detected