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§
Sourcefn system_state() -> &'static OnceLock<TestSystemState>
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
Sourcefn custom_state() -> &'static OnceLock<Self::CustomTestState>
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
Provided Methods§
Sourcefn get_system_state() -> Result<&'static TestSystemState, Failed>
fn get_system_state() -> Result<&'static TestSystemState, Failed>
Provides individual tests an easy way to grab the static TestSystemState
Sourcefn get_custom_state() -> Result<&'static Self::CustomTestState, Failed>
fn get_custom_state() -> Result<&'static Self::CustomTestState, Failed>
Provides individual tests an easy way to grab the static Self::CustomTestState
Sourcefn check_args(final_args: TestSystemState) -> Result<(), Failed>
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
Sourcefn run_tests(
args: &Arguments,
system_state: TestSystemState,
custom_state: Self::CustomTestState,
) -> Result<(), Failed>where
Self::CustomTestState: 'static,
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.