Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test that persistence is working #1919

Merged
merged 1 commit into from
Jan 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion tests/smoke/smoke_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@ limitations under the License.
package elemental_test

import (
"fmt"
"math/rand"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

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

Expand All @@ -37,13 +41,19 @@ var _ = Describe("Elemental Smoke tests", func() {
})

Context("After install", func() {

It("has default services on", func() {
for _, svc := range []string{"systemd-timesyncd"} {
sut.SystemdUnitIsActive(svc, s)
}
})

persistentFileName := fmt.Sprintf("file-%v.txt", rand.Int())
persistentData := rand.Uint32()
It("can save a file to persistent storage", func() {
_, err := s.Command(fmt.Sprintf("echo %v > %v", persistentData, persistentFileName))
Expect(err).ToNot(HaveOccurred())
})

It("can boot into passive", func() {
err := s.ChangeBootOnce(sut.Passive)
Expect(err).ToNot(HaveOccurred())
Expand Down Expand Up @@ -80,6 +90,12 @@ var _ = Describe("Elemental Smoke tests", func() {
s.Reboot()
})

It("can read the file from persistent storage", func() {
data, err := s.Command(fmt.Sprintf("cat %v", persistentFileName))
Expect(err).ToNot(HaveOccurred())
Expect(data).To(Equal(fmt.Sprintf("%v\n", persistentData)))
})

It("fails running elemental reset from COS_ACTIVE", func() {
out, err := s.Command(s.ElementalCmd("reset"))
Expect(err).To(HaveOccurred())
Expand Down
Loading