From 76caad5f6ee53e33f93037ef4e2ae27bcb5e6301 Mon Sep 17 00:00:00 2001 From: David Cassany Date: Thu, 18 Jul 2024 17:50:34 +0200 Subject: [PATCH] Add test for auto disabled boot entry in Grub Signed-off-by: David Cassany --- pkg/bootloader/grub_test.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pkg/bootloader/grub_test.go b/pkg/bootloader/grub_test.go index 90714b57e78..270287f9dac 100644 --- a/pkg/bootloader/grub_test.go +++ b/pkg/bootloader/grub_test.go @@ -109,8 +109,15 @@ var _ = Describe("Booloader", Label("bootloader", "grub"), func() { ) }) - It("installs without errors", func() { - grub = bootloader.NewGrub(cfg, bootloader.WithGrubDisableBootEntry(true)) + It("installs without errors and auto detects there is no writable efivars", func() { + runner.SideEffect = func(cmd string, args ...string) ([]byte, error) { + if cmd == "findmnt" && len(args) > 0 && args[0] == "-fno" { + return []byte("ro"), nil + } + return []byte{}, nil + } + + grub = bootloader.NewGrub(cfg, bootloader.WithGrubAutoDisableBootEntry()) Expect(grub.Install(rootDir, efiDir)).To(Succeed()) // Check grub config in EFI directory