Skip to content

test_util: expose and extend OCI image builder API#312

Open
cgwalters wants to merge 1 commit into
composefs:mainfrom
cgwalters:expose-more-test-infra
Open

test_util: expose and extend OCI image builder API#312
cgwalters wants to merge 1 commit into
composefs:mainfrom
cgwalters:expose-more-test-infra

Conversation

@cgwalters

Copy link
Copy Markdown
Collaborator

Expose the core building blocks so downstream crates (e.g. bootc) can use them under feature = "test":

  • dumpfile_to_tar() and create_multi_layer_image() made pub
  • pub const LAYER_SELINUX: a minimal targeted policy tree (/etc/selinux/config + file_contexts for /, /usr, /etc, /boot, /var)

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)

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>
@cgwalters cgwalters force-pushed the expose-more-test-infra branch from b2b0861 to 9fbfae4 Compare June 9, 2026 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant