From 4b563953096ede47f00be2f8d1905afebc16ff24 Mon Sep 17 00:00:00 2001 From: Itxaka Date: Wed, 20 Nov 2024 16:41:17 +0100 Subject: [PATCH] Adapt bootentry tests Signed-off-by: Itxaka --- pkg/action/bootentries_test.go | 72 +++++++++++++++++----------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/pkg/action/bootentries_test.go b/pkg/action/bootentries_test.go index c5f2bbb8..04521a78 100644 --- a/pkg/action/bootentries_test.go +++ b/pkg/action/bootentries_test.go @@ -139,13 +139,13 @@ var _ = Describe("Bootentries tests", Label("bootentry"), func() { Expect(err.Error()).To(ContainSubstring("does not exist")) }) It("selects the boot entry in a default installation", func() { - err := fs.WriteFile("/efi/loader/entries/active.conf", []byte("title kairos\nefi /EFI/kairos/active.efi\n"), os.ModePerm) + err := fs.WriteFile("/efi/loader/entries/active+3.conf", []byte("title kairos\nefi /EFI/kairos/active.efi\n"), os.ModePerm) Expect(err).ToNot(HaveOccurred()) - err = fs.WriteFile("/efi/loader/entries/passive.conf", []byte("title kairos (fallback)\nefi /EFI/kairos/passive.efi\n"), os.ModePerm) + err = fs.WriteFile("/efi/loader/entries/passive+3.conf", []byte("title kairos (fallback)\nefi /EFI/kairos/passive.efi\n"), os.ModePerm) Expect(err).ToNot(HaveOccurred()) - err = fs.WriteFile("/efi/loader/entries/recovery.conf", []byte("title kairos recovery\nefi /EFI/kairos/recovery.efi\n"), os.ModePerm) + err = fs.WriteFile("/efi/loader/entries/recovery+3.conf", []byte("title kairos recovery\nefi /EFI/kairos/recovery.efi\n"), os.ModePerm) Expect(err).ToNot(HaveOccurred()) - err = fs.WriteFile("/efi/loader/entries/statereset.conf", []byte("title kairos state reset (auto)\nefi /EFI/kairos/statereset.efi\n"), os.ModePerm) + err = fs.WriteFile("/efi/loader/entries/statereset+3.conf", []byte("title kairos state reset (auto)\nefi /EFI/kairos/statereset.efi\n"), os.ModePerm) Expect(err).ToNot(HaveOccurred()) err = fs.WriteFile("/efi/loader/loader.conf", []byte(""), os.ModePerm) Expect(err).ToNot(HaveOccurred()) @@ -155,7 +155,7 @@ var _ = Describe("Bootentries tests", Label("bootentry"), func() { Expect(memLog.String()).To(ContainSubstring("Default boot entry set to fallback")) reader, err := utils.SystemdBootConfReader(fs, "/efi/loader/loader.conf") Expect(err).ToNot(HaveOccurred()) - Expect(reader["default"]).To(Equal("passive.conf")) + Expect(reader["default"]).To(Equal("passive+3.conf")) // Should have called a remount to make it RW Expect(syscallMock.WasMountCalledWith( "", @@ -176,7 +176,7 @@ var _ = Describe("Bootentries tests", Label("bootentry"), func() { Expect(memLog.String()).To(ContainSubstring("Default boot entry set to recovery")) reader, err = utils.SystemdBootConfReader(fs, "/efi/loader/loader.conf") Expect(err).ToNot(HaveOccurred()) - Expect(reader["default"]).To(Equal("recovery.conf")) + Expect(reader["default"]).To(Equal("recovery+3.conf")) // Should have called a remount to make it RW Expect(syscallMock.WasMountCalledWith( "", @@ -197,7 +197,7 @@ var _ = Describe("Bootentries tests", Label("bootentry"), func() { Expect(memLog.String()).To(ContainSubstring("Default boot entry set to statereset")) reader, err = utils.SystemdBootConfReader(fs, "/efi/loader/loader.conf") Expect(err).ToNot(HaveOccurred()) - Expect(reader["default"]).To(Equal("statereset.conf")) + Expect(reader["default"]).To(Equal("statereset+3.conf")) // Should have called a remount to make it RW Expect(syscallMock.WasMountCalledWith( "", @@ -218,7 +218,7 @@ var _ = Describe("Bootentries tests", Label("bootentry"), func() { Expect(memLog.String()).To(ContainSubstring("Default boot entry set to cos")) reader, err = utils.SystemdBootConfReader(fs, "/efi/loader/loader.conf") Expect(err).ToNot(HaveOccurred()) - Expect(reader["default"]).To(Equal("active.conf")) + Expect(reader["default"]).To(Equal("active+3.conf")) // Should have called a remount to make it RW Expect(syscallMock.WasMountCalledWith( "", @@ -240,7 +240,7 @@ var _ = Describe("Bootentries tests", Label("bootentry"), func() { Expect(memLog.String()).To(ContainSubstring("Default boot entry set to active")) reader, err = utils.SystemdBootConfReader(fs, "/efi/loader/loader.conf") Expect(err).ToNot(HaveOccurred()) - Expect(reader["default"]).To(Equal("active.conf")) + Expect(reader["default"]).To(Equal("active+3.conf")) // Should have called a remount to make it RW Expect(syscallMock.WasMountCalledWith( "", @@ -258,13 +258,13 @@ var _ = Describe("Bootentries tests", Label("bootentry"), func() { }) It("selects the boot entry in a extend-cmdline installation with boot branding", func() { - err := fs.WriteFile("/efi/loader/entries/active_install-mode_awesomeos.conf", []byte("title awesomeos\nefi /EFI/kairos/active_install-mode_awesomeos.efi\n"), os.ModePerm) + err := fs.WriteFile("/efi/loader/entries/active_install-mode_awesomeos+3.conf", []byte("title awesomeos\nefi /EFI/kairos/active_install-mode_awesomeos.efi\n"), os.ModePerm) Expect(err).ToNot(HaveOccurred()) - err = fs.WriteFile("/efi/loader/entries/passive_install-mode_awesomeos.conf", []byte("title awesomeos (fallback)\nefi /EFI/kairos/passive_install-mode_awesomeos.efi\n"), os.ModePerm) + err = fs.WriteFile("/efi/loader/entries/passive_install-mode_awesomeos+3.conf", []byte("title awesomeos (fallback)\nefi /EFI/kairos/passive_install-mode_awesomeos.efi\n"), os.ModePerm) Expect(err).ToNot(HaveOccurred()) - err = fs.WriteFile("/efi/loader/entries/recovery_install-mode_awesomeos.conf", []byte("title awesomeos recovery\nefi /EFI/kairos/recovery_install-mode_awesomeos.efi\n"), os.ModePerm) + err = fs.WriteFile("/efi/loader/entries/recovery_install-mode_awesomeos+3.conf", []byte("title awesomeos recovery\nefi /EFI/kairos/recovery_install-mode_awesomeos.efi\n"), os.ModePerm) Expect(err).ToNot(HaveOccurred()) - err = fs.WriteFile("/efi/loader/entries/statereset_install-mode_awesomeos.conf", []byte("title awesomeos state reset (auto)\nefi /EFI/kairos/statereset_install-mode_awesomeos.efi\n"), os.ModePerm) + err = fs.WriteFile("/efi/loader/entries/statereset_install-mode_awesomeos+3.conf", []byte("title awesomeos state reset (auto)\nefi /EFI/kairos/statereset_install-mode_awesomeos.efi\n"), os.ModePerm) Expect(err).ToNot(HaveOccurred()) err = fs.WriteFile("/efi/loader/loader.conf", []byte(""), os.ModePerm) Expect(err).ToNot(HaveOccurred()) @@ -274,7 +274,7 @@ var _ = Describe("Bootentries tests", Label("bootentry"), func() { Expect(memLog.String()).To(ContainSubstring("Default boot entry set to fallback")) reader, err := utils.SystemdBootConfReader(fs, "/efi/loader/loader.conf") Expect(err).ToNot(HaveOccurred()) - Expect(reader["default"]).To(Equal("passive_install-mode_awesomeos.conf")) + Expect(reader["default"]).To(Equal("passive_install-mode_awesomeos+3.conf")) // Should have called a remount to make it RW Expect(syscallMock.WasMountCalledWith( "", @@ -295,7 +295,7 @@ var _ = Describe("Bootentries tests", Label("bootentry"), func() { Expect(memLog.String()).To(ContainSubstring("Default boot entry set to recovery")) reader, err = utils.SystemdBootConfReader(fs, "/efi/loader/loader.conf") Expect(err).ToNot(HaveOccurred()) - Expect(reader["default"]).To(Equal("recovery_install-mode_awesomeos.conf")) + Expect(reader["default"]).To(Equal("recovery_install-mode_awesomeos+3.conf")) // Should have called a remount to make it RW Expect(syscallMock.WasMountCalledWith( "", @@ -316,7 +316,7 @@ var _ = Describe("Bootentries tests", Label("bootentry"), func() { Expect(memLog.String()).To(ContainSubstring("Default boot entry set to statereset")) reader, err = utils.SystemdBootConfReader(fs, "/efi/loader/loader.conf") Expect(err).ToNot(HaveOccurred()) - Expect(reader["default"]).To(Equal("statereset_install-mode_awesomeos.conf")) + Expect(reader["default"]).To(Equal("statereset_install-mode_awesomeos+3.conf")) // Should have called a remount to make it RW Expect(syscallMock.WasMountCalledWith( "", @@ -337,7 +337,7 @@ var _ = Describe("Bootentries tests", Label("bootentry"), func() { Expect(memLog.String()).To(ContainSubstring("Default boot entry set to cos")) reader, err = utils.SystemdBootConfReader(fs, "/efi/loader/loader.conf") Expect(err).ToNot(HaveOccurred()) - Expect(reader["default"]).To(Equal("active_install-mode_awesomeos.conf")) + Expect(reader["default"]).To(Equal("active_install-mode_awesomeos+3.conf")) // Should have called a remount to make it RW Expect(syscallMock.WasMountCalledWith( "", @@ -359,7 +359,7 @@ var _ = Describe("Bootentries tests", Label("bootentry"), func() { Expect(memLog.String()).To(ContainSubstring("Default boot entry set to active")) reader, err = utils.SystemdBootConfReader(fs, "/efi/loader/loader.conf") Expect(err).ToNot(HaveOccurred()) - Expect(reader["default"]).To(Equal("active_install-mode_awesomeos.conf")) + Expect(reader["default"]).To(Equal("active_install-mode_awesomeos+3.conf")) // Should have called a remount to make it RW Expect(syscallMock.WasMountCalledWith( "", @@ -377,21 +377,21 @@ var _ = Describe("Bootentries tests", Label("bootentry"), func() { }) It("selects the boot entry in a extra-cmdline installation", func() { - err := fs.WriteFile("/efi/loader/entries/active.conf", []byte("title Kairos\nefi /EFI/kairos/active.efi\n"), os.ModePerm) + err := fs.WriteFile("/efi/loader/entries/active+3.conf", []byte("title Kairos\nefi /EFI/kairos/active.efi\n"), os.ModePerm) Expect(err).ToNot(HaveOccurred()) - err = fs.WriteFile("/efi/loader/entries/active_foobar.conf", []byte("title Kairos\nefi /EFI/kairos/active_foobar.efi\n"), os.ModePerm) + err = fs.WriteFile("/efi/loader/entries/active_foobar+3.conf", []byte("title Kairos\nefi /EFI/kairos/active_foobar.efi\n"), os.ModePerm) Expect(err).ToNot(HaveOccurred()) - err = fs.WriteFile("/efi/loader/entries/passive.conf", []byte("title Kairos (fallback)\nefi /EFI/kairos/passive.efi\n"), os.ModePerm) + err = fs.WriteFile("/efi/loader/entries/passive+3.conf", []byte("title Kairos (fallback)\nefi /EFI/kairos/passive.efi\n"), os.ModePerm) Expect(err).ToNot(HaveOccurred()) - err = fs.WriteFile("/efi/loader/entries/passive_foobar.conf", []byte("title Kairos (fallback)\nefi /EFI/kairos/passive_foobar.efi\n"), os.ModePerm) + err = fs.WriteFile("/efi/loader/entries/passive_foobar+3.conf", []byte("title Kairos (fallback)\nefi /EFI/kairos/passive_foobar.efi\n"), os.ModePerm) Expect(err).ToNot(HaveOccurred()) - err = fs.WriteFile("/efi/loader/entries/recovery.conf", []byte("title Kairos recovery\nefi /EFI/kairos/recovery.efi\n"), os.ModePerm) + err = fs.WriteFile("/efi/loader/entries/recovery+3.conf", []byte("title Kairos recovery\nefi /EFI/kairos/recovery.efi\n"), os.ModePerm) Expect(err).ToNot(HaveOccurred()) - err = fs.WriteFile("/efi/loader/entries/recovery_foobar.conf", []byte("title Kairos recovery\nefi /EFI/kairos/recovery_foobar.efi\n"), os.ModePerm) + err = fs.WriteFile("/efi/loader/entries/recovery_foobar+3.conf", []byte("title Kairos recovery\nefi /EFI/kairos/recovery_foobar.efi\n"), os.ModePerm) Expect(err).ToNot(HaveOccurred()) - err = fs.WriteFile("/efi/loader/entries/statereset.conf", []byte("title Kairos state reset (auto)\nefi /EFI/kairos/statereset.efi\n"), os.ModePerm) + err = fs.WriteFile("/efi/loader/entries/statereset+3.conf", []byte("title Kairos state reset (auto)\nefi /EFI/kairos/statereset.efi\n"), os.ModePerm) Expect(err).ToNot(HaveOccurred()) - err = fs.WriteFile("/efi/loader/entries/statereset_foobar.conf", []byte("title Kairos state reset (auto)\nefi /EFI/kairos/state_reset_foobar.efi\n"), os.ModePerm) + err = fs.WriteFile("/efi/loader/entries/statereset_foobar+3.conf", []byte("title Kairos state reset (auto)\nefi /EFI/kairos/state_reset_foobar.efi\n"), os.ModePerm) Expect(err).ToNot(HaveOccurred()) err = fs.WriteFile("/efi/loader/loader.conf", []byte(""), os.ModePerm) Expect(err).ToNot(HaveOccurred()) @@ -401,7 +401,7 @@ var _ = Describe("Bootentries tests", Label("bootentry"), func() { Expect(memLog.String()).To(ContainSubstring("Default boot entry set to fallback")) reader, err := utils.SystemdBootConfReader(fs, "/efi/loader/loader.conf") Expect(err).ToNot(HaveOccurred()) - Expect(reader["default"]).To(Equal("passive.conf")) + Expect(reader["default"]).To(Equal("passive+3.conf")) // Should have called a remount to make it RW Expect(syscallMock.WasMountCalledWith( "", @@ -422,7 +422,7 @@ var _ = Describe("Bootentries tests", Label("bootentry"), func() { Expect(memLog.String()).To(ContainSubstring("Default boot entry set to fallback foobar")) reader, err = utils.SystemdBootConfReader(fs, "/efi/loader/loader.conf") Expect(err).ToNot(HaveOccurred()) - Expect(reader["default"]).To(Equal("passive_foobar.conf")) + Expect(reader["default"]).To(Equal("passive_foobar+3.conf")) // Should have called a remount to make it RW Expect(syscallMock.WasMountCalledWith( "", @@ -443,7 +443,7 @@ var _ = Describe("Bootentries tests", Label("bootentry"), func() { Expect(memLog.String()).To(ContainSubstring("Default boot entry set to recovery")) reader, err = utils.SystemdBootConfReader(fs, "/efi/loader/loader.conf") Expect(err).ToNot(HaveOccurred()) - Expect(reader["default"]).To(Equal("recovery.conf")) + Expect(reader["default"]).To(Equal("recovery+3.conf")) // Should have called a remount to make it RW Expect(syscallMock.WasMountCalledWith( "", @@ -464,7 +464,7 @@ var _ = Describe("Bootentries tests", Label("bootentry"), func() { Expect(memLog.String()).To(ContainSubstring("Default boot entry set to recovery foobar")) reader, err = utils.SystemdBootConfReader(fs, "/efi/loader/loader.conf") Expect(err).ToNot(HaveOccurred()) - Expect(reader["default"]).To(Equal("recovery_foobar.conf")) + Expect(reader["default"]).To(Equal("recovery_foobar+3.conf")) // Should have called a remount to make it RW Expect(syscallMock.WasMountCalledWith( "", @@ -485,7 +485,7 @@ var _ = Describe("Bootentries tests", Label("bootentry"), func() { Expect(memLog.String()).To(ContainSubstring("Default boot entry set to statereset")) reader, err = utils.SystemdBootConfReader(fs, "/efi/loader/loader.conf") Expect(err).ToNot(HaveOccurred()) - Expect(reader["default"]).To(Equal("statereset.conf")) + Expect(reader["default"]).To(Equal("statereset+3.conf")) // Should have called a remount to make it RW Expect(syscallMock.WasMountCalledWith( "", @@ -506,7 +506,7 @@ var _ = Describe("Bootentries tests", Label("bootentry"), func() { Expect(memLog.String()).To(ContainSubstring("Default boot entry set to statereset foobar")) reader, err = utils.SystemdBootConfReader(fs, "/efi/loader/loader.conf") Expect(err).ToNot(HaveOccurred()) - Expect(reader["default"]).To(Equal("statereset_foobar.conf")) + Expect(reader["default"]).To(Equal("statereset_foobar+3.conf")) // Should have called a remount to make it RW Expect(syscallMock.WasMountCalledWith( "", @@ -527,7 +527,7 @@ var _ = Describe("Bootentries tests", Label("bootentry"), func() { Expect(memLog.String()).To(ContainSubstring("Default boot entry set to cos")) reader, err = utils.SystemdBootConfReader(fs, "/efi/loader/loader.conf") Expect(err).ToNot(HaveOccurred()) - Expect(reader["default"]).To(Equal("active.conf")) + Expect(reader["default"]).To(Equal("active+3.conf")) // Should have called a remount to make it RW Expect(syscallMock.WasMountCalledWith( "", @@ -548,7 +548,7 @@ var _ = Describe("Bootentries tests", Label("bootentry"), func() { Expect(memLog.String()).To(ContainSubstring("Default boot entry set to cos foobar")) reader, err = utils.SystemdBootConfReader(fs, "/efi/loader/loader.conf") Expect(err).ToNot(HaveOccurred()) - Expect(reader["default"]).To(Equal("active_foobar.conf")) + Expect(reader["default"]).To(Equal("active_foobar+3.conf")) // Should have called a remount to make it RW Expect(syscallMock.WasMountCalledWith( "", @@ -570,7 +570,7 @@ var _ = Describe("Bootentries tests", Label("bootentry"), func() { Expect(memLog.String()).To(ContainSubstring("Default boot entry set to active")) reader, err = utils.SystemdBootConfReader(fs, "/efi/loader/loader.conf") Expect(err).ToNot(HaveOccurred()) - Expect(reader["default"]).To(Equal("active.conf")) + Expect(reader["default"]).To(Equal("active+3.conf")) // Should have called a remount to make it RW Expect(syscallMock.WasMountCalledWith( "", @@ -590,7 +590,7 @@ var _ = Describe("Bootentries tests", Label("bootentry"), func() { Expect(memLog.String()).To(ContainSubstring("Default boot entry set to active foobar")) reader, err = utils.SystemdBootConfReader(fs, "/efi/loader/loader.conf") Expect(err).ToNot(HaveOccurred()) - Expect(reader["default"]).To(Equal("active_foobar.conf")) + Expect(reader["default"]).To(Equal("active_foobar+3.conf")) // Should have called a remount to make it RW Expect(syscallMock.WasMountCalledWith( "",