From cad87b77c0003c851abb6264d3e373e9516edaae Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Wed, 12 Aug 2026 02:33:28 +0000 Subject: Compile typed package requests from build plans --- tests/package_installer.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests/package_installer.rs') diff --git a/tests/package_installer.rs b/tests/package_installer.rs index 622d378..b322aa9 100644 --- a/tests/package_installer.rs +++ b/tests/package_installer.rs @@ -1,6 +1,7 @@ use std::path::PathBuf; use alt_controller_image::hasher::{CommandRunner, HasherInstaller, Invocation}; +use alt_controller_image::{BuildPlan, ImageSpec}; use alt_controller_image::package_installer::{AptConfig, PackageInstaller, PackageRequest}; #[derive(Default)] @@ -70,3 +71,20 @@ fn package_request_rejects_empty_packages_and_unsafe_apt_config_paths() { ) .is_err()); } + +#[test] +fn build_plan_compiles_its_typed_package_request() { + let spec = ImageSpec::load(std::path::Path::new("profiles/alt-controller.toml")) + .expect("load controller spec"); + let plan = BuildPlan::compile(spec).expect("compile controller plan"); + + let request = plan + .package_request("work/alt-controller", "profiles/apt.conf") + .expect("compile package request"); + + assert_eq!(request.workdir(), std::path::Path::new("work/alt-controller")); + assert_eq!(request.apt_config().as_path(), std::path::Path::new("profiles/apt.conf")); + assert_eq!(request.packages()[0], "apt"); + assert!(request.packages().contains(&"libiec61850".to_owned())); + assert_eq!(request.selectors(), ["^kernel-(image|modules-())-(rt)$"]); +} -- cgit v1.2.3