mirror of
https://github.com/containers/youki
synced 2024-05-17 21:16:30 +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>
1.9 KiB
1.9 KiB
rust oci tests
This is youki's original integration to verify the behavior of the low-level container runtime.
How to run
just rust-oci-tests
How to write
We will not go into detail here, but will explain how to write and add a new test vase based on an example test.
Fully the code of the example test
{{#include ../../../../tests/integration_test/src/tests/example/hello_world.rs}}
-
Build the OCI Runtime Spec you want to verify
This testing framework automatically places runtimetest in the container. In other words, you can test the processes you want to execute within a container by writing them in runtimetest. Therefore, it is common practice here to write an OCI Runtime Spec that executes
runtimetest
.
{{#include ../../../../tests/integration_test/src/tests/example/hello_world.rs:get_example_spec}}
- Prepare a function that returns a
TestResult
, which represents the result of the test.
{{#include ../../../../tests/integration_test/src/tests/example/hello_world.rs:example_test}}
- Create a
TestGroup
and register a test case you created
{{#include ../../../../tests/integration_test/src/tests/example/hello_world.rs:get_example_test}}
- Register the
TestGroup
you created to aTestManager
{{#include ../../../../tests/integration_test/src/main.rs:register_example_test}}
- Write the validation you want to run within a test container
{{#include ../../../../tests/runtimetest/src/main.rs:example_runtimetest_main}}
{{#include ../../../../tests/runtimetest/src/tests.rs:example_hello_world}}