Skip to content

Commit

Permalink
Add state check for installer tests
Browse files Browse the repository at this point in the history
Signed-off-by: David Cassany <dcassany@suse.com>
  • Loading branch information
davidcassany committed Sep 18, 2024
1 parent 4e354a1 commit 8a61e9f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions tests/installer/installer_efi_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cos_test

import (
"fmt"
"gopkg.in/yaml.v3"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
Expand Down Expand Up @@ -38,7 +38,6 @@ var _ = Describe("Elemental Installer EFI tests", func() {
By("Running the elemental install with a layout file")
Expect(err).To(BeNil())
out, err := s.Command(s.ElementalCmd("install", "--squash-no-compression", "/dev/vda"))
fmt.Printf(out)
Expect(err).To(BeNil())
Expect(out).To(ContainSubstring("Mounting disk partitions"))
Expect(out).To(ContainSubstring("Partitioning device..."))
Expand Down Expand Up @@ -76,6 +75,15 @@ var _ = Describe("Elemental Installer EFI tests", func() {
} {
CheckPartitionValues(disk, part)
}
By("check state file includes expected actions for the first snapshot and recovery image")
stateStr, err := s.Command(s.ElementalCmd("state"))
Expect(err).NotTo(HaveOccurred())

state := map[string]interface{}{}
Expect(yaml.Unmarshal([]byte(stateStr), state)).
To(Succeed())
Expect(state["state"].(map[string]interface{})["snapshots"].(map[interface{}]interface{})[1].(map[string]interface{})["fromAction"]).
To(Equal("install"))
})
})
})
Expand Down

0 comments on commit 8a61e9f

Please sign in to comment.