-
Notifications
You must be signed in to change notification settings - Fork 347
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add schedule entity dd:qSigned-off-by: lengrongfu <[email protected]> Signed-off-by: lengrongfu <[email protected]> * Fix if condition for nice value check Signed-off-by: Yashodhan Joshi <[email protected]> * Remove the old integration tests files Signed-off-by: Yashodhan Joshi <[email protected]> --------- Signed-off-by: lengrongfu <[email protected]> Signed-off-by: Yashodhan Joshi <[email protected]> Co-authored-by: Yashodhan Joshi <[email protected]>
- Loading branch information
1 parent
3f08ae7
commit 2723aa4
Showing
12 changed files
with
255 additions
and
4 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
mod scheduler_policy; | ||
|
||
pub use scheduler_policy::get_scheduler_test; |
56 changes: 56 additions & 0 deletions
56
tests/contest/contest/src/tests/scheduler/scheduler_policy.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
use anyhow::{Context, Result}; | ||
use oci_spec::runtime::{ | ||
LinuxSchedulerPolicy, ProcessBuilder, SchedulerBuilder, Spec, SpecBuilder, | ||
}; | ||
use test_framework::{test_result, Test, TestGroup, TestResult}; | ||
|
||
use crate::utils::test_inside_container; | ||
|
||
fn create_spec(policy: LinuxSchedulerPolicy, execute_test: &str) -> Result<Spec> { | ||
let sc = SchedulerBuilder::default() | ||
.policy(policy) | ||
.nice(1i32) | ||
.build() | ||
.unwrap(); | ||
SpecBuilder::default() | ||
.process( | ||
ProcessBuilder::default() | ||
.args( | ||
["runtimetest", execute_test] | ||
.iter() | ||
.map(|s| s.to_string()) | ||
.collect::<Vec<String>>(), | ||
) | ||
.scheduler(sc) | ||
.build()?, | ||
) | ||
.build() | ||
.context("failed to create spec") | ||
} | ||
|
||
fn scheduler_policy_other_test() -> TestResult { | ||
let spec = test_result!(create_spec( | ||
LinuxSchedulerPolicy::SchedOther, | ||
"scheduler_policy_other" | ||
)); | ||
test_inside_container(spec, &|_| Ok(())) | ||
} | ||
|
||
fn scheduler_policy_batch_test() -> TestResult { | ||
let spec = test_result!(create_spec( | ||
LinuxSchedulerPolicy::SchedBatch, | ||
"scheduler_policy_batch" | ||
)); | ||
test_inside_container(spec, &|_| Ok(())) | ||
} | ||
|
||
pub fn get_scheduler_test() -> TestGroup { | ||
let mut scheduler_policy_group = TestGroup::new("set_scheduler_policy"); | ||
let policy_fifo_test = Test::new("policy_other", Box::new(scheduler_policy_other_test)); | ||
let policy_rr_test = Test::new("policy_batch", Box::new(scheduler_policy_batch_test)); | ||
|
||
scheduler_policy_group.add(vec![Box::new(policy_fifo_test)]); | ||
scheduler_policy_group.add(vec![Box::new(policy_rr_test)]); | ||
|
||
scheduler_policy_group | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.