test_util: expose and extend OCI image builder API#312
Open
cgwalters wants to merge 1 commit into
Open
Conversation
In bootc we also want to have tests for things dealing with OCI, especially as we transition to unified storage. Expose `pub` APIs for this stuff but only under #[cfg(test)]. Assisted-by: OpenCode (Claude Sonnet 4.6) Signed-off-by: Colin Walters <walters@verbum.org>
b2b0861 to
9fbfae4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Expose the core building blocks so downstream crates (e.g. bootc) can use them under feature = "test":
Replace the ad-hoc create_bootable_image(version: u32) / create_selinux_bootable_image sprawl with a clean builder:
OsImage::bootable(KernelVersion::V1)
.with_selinux()
.with_layer("/usr/lib/os-release 0 100644 ...")
.build_oci(repo, Some("test:v1"))
.await
OsProfile (Minimal / Bootable { version: KernelVersion }) and OsFeatures { selinux } replace the growing list of separate functions. with_layer(dumpfile) appends an arbitrary dumpfile layer on top of all profile and feature layers — the primary hook for callers that need to inject specific files without assembling a full image from scratch. build_filesystem(repo) returns a FileSystem suitable for passing to transform_for_boot or selabel.
The existing create_base_image / create_bootable_image free functions are kept as thin wrappers for zero call-site churn.
Assisted-by: OpenCode (Claude Sonnet 4.6)