Merge pull request #48 from nix-community/improve-gc-integration-test

Lanzatool: improve gc integration test
This commit is contained in:
nikstur 2023-01-04 22:27:45 +01:00 committed by GitHub
commit 8cd7452194
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 2 deletions

View File

@ -19,16 +19,27 @@ fn keep_only_configured_number_of_generations() -> Result<()> {
})
.collect();
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.
let output0 = common::lanzaboote_install(0, esp_mountpoint.path(), generation_links.clone())?;
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.
let output1 = common::lanzaboote_install(2, esp_mountpoint.path(), generation_links)?;
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(())
}