diff options
| author | Hermes Agent <hermes@localhost> | 2026-08-12 04:54:43 +0000 |
|---|---|---|
| committer | Hermes Agent <hermes@localhost> | 2026-08-12 04:54:43 +0000 |
| commit | 4c01f2c2464f4133cb48125c8f2c55827cf0bf67 (patch) | |
| tree | 283be3ebed1ed658d7be92a11b362fec64aa7d6d /tests | |
| parent | a73d7e29c0064e0a40ffcfb98f6b349ced5463b2 (diff) | |
Validate APT config before creating build workspace
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/build.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/build.rs b/tests/build.rs index fd919a0..d278bce 100644 --- a/tests/build.rs +++ b/tests/build.rs @@ -89,3 +89,23 @@ fn refuses_to_reuse_an_existing_workspace() { assert!(error.to_string().contains("workspace already exists")); assert!(installer.requests.borrow().is_empty()); } + +#[test] +fn rejects_a_missing_apt_configuration_before_creating_the_workspace() { + let fixture = tempdir().expect("fixture directory"); + let spec = ImageSpec::load(std::path::Path::new("profiles/alt-controller.toml")) + .expect("load controller spec"); + let plan = BuildPlan::compile(spec).expect("compile build plan"); + let installer = FixtureInstaller::default(); + let mut executor = BuildExecutor::new(&installer, FixtureInitramfsBuilder); + let workspace = fixture.path().join("work"); + let missing_apt_config = fixture.path().join("missing-apt.conf"); + + let error = executor + .execute(&plan, &workspace, &missing_apt_config, fixture.path().join("image.tar")) + .expect_err("missing APT configuration must be rejected"); + + assert!(error.to_string().contains("APT configuration does not exist")); + assert!(!workspace.exists()); + assert!(installer.requests.borrow().is_empty()); +} |