Skip to content

[Test]: Add is_runtime_youki() helper to contest test framework for consistent skip logic #3444

@nayuta723

Description

@nayuta723

Background

When working on a FEATURE issue, it is often useful to split the work into separate PRs — one for adding the tests and one for the feature implementation itself. This allows tests to be merged early (guarded with TestResult::Skipped) and then re-enabled when the feature PR lands.

Currently, is_runtime_runc() exists in tests/contest/contest/src/utils/support.rs to skip tests when running against runc. There is no equivalent for youki, making it inconsistent and forcing ad-hoc checks like get_runtime_path().ends_with("youki") inline in test functions.

Feature Request

Add is_runtime_youki() to support.rs, mirroring is_runtime_runc(), and establish a convention of using ConditionalTest with this helper for all youki-specific skip logic.

Is the request related to some problem running youki?

Proposed Solution

Add the following to tests/contest/contest/src/utils/support.rs:

pub fn is_runtime_youki() -> bool {
    match std::env::var("RUNTIME_KIND") {
        Err(_) => false,
        Ok(s) => s == "youki",
    }
}

Usage with ConditionalTest:

ConditionalTest::new(
    "my_youki_specific_test",
    Box::new(|| !is_runtime_youki()), // skip when youki
    Box::new(|| { /* test body */ }),
)

Considerations

Additional Context

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions