Skip to content

Commit

Permalink
Make grubfallback test more generic
Browse files Browse the repository at this point in the history
Signed-off-by: David Cassany <dcassany@suse.com>
  • Loading branch information
davidcassany committed Feb 14, 2024
1 parent a5e94a9 commit 305f130
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions tests/grubfallback/grubfallback_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ limitations under the License.
package elemental_test

import (
"fmt"

sut "github.com/rancher/elemental-toolkit/tests/vm"

. "github.com/onsi/ginkgo/v2"
Expand Down Expand Up @@ -44,9 +46,15 @@ var _ = Describe("Elemental booting fallback tests", func() {
It("fallbacks by booting into recovery", func() {
Expect(s.BootFrom()).To(Equal(sut.Active))

_, err := s.Command("mount -o rw,remount /run/initramfs/elemental-state")
_, err := s.Command("mount -o rw,remount /run/elemental/efi")
Expect(err).ToNot(HaveOccurred())
_, err = s.Command("rm -rf /run/initramfs/elemental-state/.snapshots/1/snapshot.img")
cmd := "grub2-editenv"
_, err = s.Command(fmt.Sprintf("which %s", cmd))
if err != nil {
cmd = "grub-editenv"
}

_, err = s.Command(fmt.Sprintf("%s /run/elemental/efi/grub_oem_env set state_label=wrongvalue", cmd))
Expect(err).ToNot(HaveOccurred())

s.Reboot()
Expand Down

0 comments on commit 305f130

Please sign in to comment.