1
0
Fork 0
mirror of https://github.com/containers/youki synced 2024-05-17 21:16:30 +02:00
youki/docs/src/developer/e2e/rust_oci_test.md
Yashodhan 80f1f36ae9
Refactor test dir structure (#2421)
* 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>
2023-10-10 21:00:02 +09:00

1.9 KiB

rust oci tests

This is youki's original integration to verify the behavior of the low-level container runtime.

Overview

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}}

  1. 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}}
  1. 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}}
  1. Create a TestGroup and register a test case you created
{{#include ../../../../tests/integration_test/src/tests/example/hello_world.rs:get_example_test}}
  1. Register the TestGroup you created to a TestManager
{{#include ../../../../tests/integration_test/src/main.rs:register_example_test}}
  1. 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}}