From c4e5ec7008fafa56387aebf86d1c3cc5f588ab60 Mon Sep 17 00:00:00 2001 From: nikstur Date: Wed, 4 Jan 2023 00:41:47 +0100 Subject: [PATCH] lanzatool: add more assertions to gc integration test --- rust/lanzatool/tests/gc.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/rust/lanzatool/tests/gc.rs b/rust/lanzatool/tests/gc.rs index 1763b39..6aa94d9 100644 --- a/rust/lanzatool/tests/gc.rs +++ b/rust/lanzatool/tests/gc.rs @@ -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(()) }