diff options
Diffstat (limited to 'tests/build.rs')
| -rw-r--r-- | tests/build.rs | 71 |
1 files changed, 58 insertions, 13 deletions
diff --git a/tests/build.rs b/tests/build.rs index a0a75b8..7d67b29 100644 --- a/tests/build.rs +++ b/tests/build.rs @@ -119,7 +119,12 @@ fn refuses_to_reuse_an_existing_workspace() { fs::create_dir(&workspace).expect("create existing workspace"); let error = executor - .execute(&plan, &workspace, "profiles/apt.conf", fixture.path().join("image.tar")) + .execute( + &plan, + &workspace, + "profiles/apt.conf", + fixture.path().join("image.tar"), + ) .expect_err("existing workspace must be rejected"); assert!(error.to_string().contains("workspace already exists")); @@ -143,7 +148,10 @@ fn rejects_an_existing_artifact_before_creating_the_workspace_or_installing() { .expect_err("pre-existing artifact must be rejected"); assert!(error.to_string().contains("output artifact already exists")); - assert_eq!(fs::read_to_string(&artifact).expect("read artifact"), "do not replace"); + assert_eq!( + fs::read_to_string(&artifact).expect("read artifact"), + "do not replace" + ); assert!(!workspace.exists()); assert!(installer.requests.borrow().is_empty()); } @@ -166,7 +174,10 @@ fn rejects_an_existing_companion_manifest_before_creating_the_workspace_or_insta .expect_err("pre-existing companion manifest must be rejected"); assert!(error.to_string().contains("output manifest already exists")); - assert_eq!(fs::read_to_string(&companion).expect("read companion manifest"), "do not replace"); + assert_eq!( + fs::read_to_string(&companion).expect("read companion manifest"), + "do not replace" + ); assert!(!workspace.exists()); assert!(installer.requests.borrow().is_empty()); } @@ -183,10 +194,19 @@ fn rejects_a_missing_apt_configuration_before_creating_the_workspace() { let missing_apt_config = fixture.path().join("missing-apt.conf"); let error = executor - .execute(&plan, &workspace, &missing_apt_config, fixture.path().join("image.tar")) + .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!( + error + .to_string() + .contains("APT configuration does not exist") + ); assert!(!workspace.exists()); assert!(installer.requests.borrow().is_empty()); } @@ -205,8 +225,15 @@ fn removes_the_new_workspace_when_package_installation_fails() { .execute(&plan, &workspace, "profiles/apt.conf", &artifact) .expect_err("failed installation must fail the build"); - assert!(error.to_string().contains("simulated package installation failure")); - assert!(!workspace.exists(), "failed build must not leave a workspace"); + assert!( + error + .to_string() + .contains("simulated package installation failure") + ); + assert!( + !workspace.exists(), + "failed build must not leave a workspace" + ); assert!(!artifact.exists()); } @@ -224,8 +251,15 @@ fn removes_the_new_workspace_when_the_installer_does_not_create_a_rootfs() { .execute(&plan, &workspace, "profiles/apt.conf", &artifact) .expect_err("missing rootfs must fail the build"); - assert!(error.to_string().contains("package installer did not create rootfs")); - assert!(!workspace.exists(), "failed build must not leave a workspace"); + assert!( + error + .to_string() + .contains("package installer did not create rootfs") + ); + assert!( + !workspace.exists(), + "failed build must not leave a workspace" + ); assert!(!artifact.exists()); } @@ -235,7 +269,8 @@ fn removes_the_new_workspace_when_rootfs_finalization_fails() { 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 mut executor = BuildExecutor::new(RootfsFinalizationFailingInstaller, FixtureInitramfsBuilder); + let mut executor = + BuildExecutor::new(RootfsFinalizationFailingInstaller, FixtureInitramfsBuilder); let workspace = fixture.path().join("work"); let artifact = fixture.path().join("image.tar"); @@ -243,7 +278,10 @@ fn removes_the_new_workspace_when_rootfs_finalization_fails() { .execute(&plan, &workspace, "profiles/apt.conf", &artifact) .expect_err("failed rootfs finalization must fail the build"); - assert!(!workspace.exists(), "failed build must not leave a workspace"); + assert!( + !workspace.exists(), + "failed build must not leave a workspace" + ); assert!(!artifact.exists()); } @@ -261,7 +299,14 @@ fn removes_the_new_workspace_when_initramfs_build_fails() { .execute(&plan, &workspace, "profiles/apt.conf", &artifact) .expect_err("failed initramfs build must fail the build"); - assert!(error.to_string().contains("simulated initramfs build failure")); - assert!(!workspace.exists(), "failed build must not leave a workspace"); + assert!( + error + .to_string() + .contains("simulated initramfs build failure") + ); + assert!( + !workspace.exists(), + "failed build must not leave a workspace" + ); assert!(!artifact.exists()); } |