mirror of
https://github.com/containers/youki
synced 2024-05-21 15:06:07 +02:00
80f1f36ae9
* Move individual rust-oci-tests components in the tests dir We can use several things from test_framework and even integration_test for additional tests such as podman rootless and wasm tests Signed-off-by: Yashodhan Joshi <yjdoc2@gmail.com> * fix scripts and docs for the new dir structure Signed-off-by: Yashodhan Joshi <yjdoc2@gmail.com> --------- Signed-off-by: Yashodhan Joshi <yjdoc2@gmail.com>
41 lines
1.2 KiB
Rust
41 lines
1.2 KiB
Rust
use anyhow::{Context, Result};
|
|
use oci_spec::runtime::{ProcessBuilder, Spec, SpecBuilder};
|
|
use test_framework::{test_result, Test, TestGroup, TestResult};
|
|
|
|
use crate::utils::test_inside_container;
|
|
|
|
////////// ANCHOR: get_example_spec
|
|
fn create_spec() -> Result<Spec> {
|
|
SpecBuilder::default()
|
|
.process(
|
|
ProcessBuilder::default()
|
|
.args(
|
|
["runtimetest", "hello_world"]
|
|
.iter()
|
|
.map(|s| s.to_string())
|
|
.collect::<Vec<String>>(),
|
|
)
|
|
.build()?,
|
|
)
|
|
.build()
|
|
.context("failed to create spec")
|
|
}
|
|
////////// ANCHOR_END: get_example_spec
|
|
|
|
////////// ANCHOR: example_test
|
|
fn example_test() -> TestResult {
|
|
let spec = test_result!(create_spec());
|
|
test_inside_container(spec, &|_| Ok(()))
|
|
}
|
|
////////// ANCHOR_END: example_test
|
|
|
|
////////// ANCHOR: get_example_test
|
|
pub fn get_example_test() -> TestGroup {
|
|
let mut test_group = TestGroup::new("example");
|
|
let test1 = Test::new("hello world", Box::new(example_test));
|
|
test_group.add(vec![Box::new(test1)]);
|
|
|
|
test_group
|
|
}
|
|
////////// ANCHOR_END: get_example_test
|