feat: add scheduler workload admission contracts (#3602)

This commit is contained in:
安正超
2026-06-19 08:41:22 +08:00
committed by GitHub
parent ada6f7587e
commit 56c3cf50ae
9 changed files with 378 additions and 15 deletions
+20
View File
@@ -239,6 +239,26 @@ mod tests {
assert_eq!(core.low_priority_size_threshold, policy.low_priority_threshold);
}
#[test]
fn test_scheduler_default_thresholds_remain_stable() {
let policy = SchedulerPolicy::default();
assert_eq!(policy.base_buffer_size, 64 * 1024);
assert_eq!(policy.max_buffer_size, 4 * 1024 * 1024);
assert_eq!(policy.high_priority_threshold, 1024 * 1024);
assert_eq!(policy.low_priority_threshold, 10 * 1024 * 1024);
}
#[test]
fn test_scheduler_priority_boundaries_remain_stable() {
let policy = SchedulerPolicy::default();
let manager = SchedulerManager::from_policy(policy);
assert_eq!(manager.get_priority(1_048_575), IoPriority::High);
assert_eq!(manager.get_priority(1_048_576), IoPriority::Normal);
assert_eq!(manager.get_priority(10_485_760), IoPriority::Normal);
assert_eq!(manager.get_priority(10_485_761), IoPriority::Low);
}
#[test]
fn test_scheduler_manager() {
let manager = SchedulerManager::new(1024, 4096, 512, 2048);