lanzatool: add more assertions to gc integration test

This commit is contained in:
nikstur 2023-01-04 00:41:47 +01:00
parent 03fa7d3401
commit c4e5ec7008
1 changed files with 13 additions and 2 deletions

View File

@ -19,16 +19,27 @@ fn keep_only_configured_number_of_generations() -> Result<()> {
}) })
.collect(); .collect();
let stub_count = || count_files(&esp_mountpoint.path().join("EFI/Linux")).unwrap(); let stub_count = || count_files(&esp_mountpoint.path().join("EFI/Linux")).unwrap();
let kernel_and_initrd_count = || count_files(&esp_mountpoint.path().join("EFI/nixos")).unwrap();
// Install all 3 generations. // Install all 3 generations.
let output0 = common::lanzaboote_install(0, esp_mountpoint.path(), generation_links.clone())?; let output0 = common::lanzaboote_install(0, esp_mountpoint.path(), generation_links.clone())?;
assert!(output0.status.success()); assert!(output0.status.success());
assert_eq!(stub_count(), 3); assert_eq!(stub_count(), 3, "Wrong number of stubs after installation");
assert_eq!(
kernel_and_initrd_count(),
6,
"Wrong number of kernels & initrds after installation"
);
// Call `lanzatool install` again with a config limit of 2 and assert that one is deleted. // Call `lanzatool install` again with a config limit of 2 and assert that one is deleted.
let output1 = common::lanzaboote_install(2, esp_mountpoint.path(), generation_links)?; let output1 = common::lanzaboote_install(2, esp_mountpoint.path(), generation_links)?;
assert!(output1.status.success()); assert!(output1.status.success());
assert_eq!(stub_count(), 2); assert_eq!(stub_count(), 2, "Wrong number of stubs after gc.");
assert_eq!(
kernel_and_initrd_count(),
4,
"Wrong number of kernels & initrds after gc."
);
Ok(()) Ok(())
} }