TestSuite

Trait TestSuite 

Source
pub trait TestSuite {
    type CustomTestState;

    // Required methods
    fn system_state() -> &'static OnceLock<TestSystemState>;
    fn custom_state() -> &'static OnceLock<Self::CustomTestState>;
    fn tests() -> Vec<Trial>;

    // Provided methods
    fn get_system_state() -> Result<&'static TestSystemState, Failed> { ... }
    fn get_custom_state() -> Result<&'static Self::CustomTestState, Failed> { ... }
    fn check_args(final_args: TestSystemState) -> Result<(), Failed> { ... }
    fn run_tests(
        args: &Arguments,
        system_state: TestSystemState,
        custom_state: Self::CustomTestState,
    ) -> Result<(), Failed>
       where Self::CustomTestState: 'static { ... }
}
Expand description

Generic integration testing harness with default implementations for common test lifecycle management

Required Associated Types§

Required Methods§

Source

fn system_state() -> &'static OnceLock<TestSystemState>

Provides a reference to a static TestSystemState needed by individual tests since [libtest_mimic] does not provide a way to pass state into tests

Source

fn custom_state() -> &'static OnceLock<Self::CustomTestState>

Provides a reference to a static Self::CustomTestState needed by individual tests since [libtest_mimic] does not provide a way to pass state into tests

Source

fn tests() -> Vec<Trial>

Provides an iterator of tests to pass to the test harness for different threads to run through.

Provided Methods§

Source

fn get_system_state() -> Result<&'static TestSystemState, Failed>

Provides individual tests an easy way to grab the static TestSystemState

Source

fn get_custom_state() -> Result<&'static Self::CustomTestState, Failed>

Provides individual tests an easy way to grab the static Self::CustomTestState

Source

fn check_args(final_args: TestSystemState) -> Result<(), Failed>

Checks whether the runtime state gathered from the Rust program or from Linux has changed throughout the lifetime of the tests

Source

fn run_tests( args: &Arguments, system_state: TestSystemState, custom_state: Self::CustomTestState, ) -> Result<(), Failed>
where Self::CustomTestState: 'static,

Default test harness lifecycle implementation

It is responsible for setting up the Rust userspace as well as checking if all tests completed successfully.

When this function exits, the SeaBee destructor will execute and unload all of the eBPF programs load

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§