forked from kairos-io/kairos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable tmp mount on ubuntu (kairos-io#136)
* ⚙️ Enable tmp mount on ubuntu image * 🤖 Add upgrade test * 🤖 Bump waiting time after reboot * 📝 Update README badge
- Loading branch information
Showing
5 changed files
with
160 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
package mos_test | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"time" | ||
|
||
"github.com/kairos-io/kairos/tests/machine" | ||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
var _ = Describe("k3s upgrade manual test", Label("upgrade-with-cli"), func() { | ||
|
||
containerImage := os.Getenv("CONTAINER_IMAGE") | ||
|
||
BeforeEach(func() { | ||
machine.EventuallyConnects() | ||
}) | ||
|
||
AfterEach(func() { | ||
if CurrentGinkgoTestDescription().Failed { | ||
gatherLogs() | ||
} | ||
}) | ||
|
||
Context("live cd", func() { | ||
|
||
It("has default service active", func() { | ||
if containerImage == "" { | ||
Fail("CONTAINER_IMAGE needs to be set") | ||
} | ||
|
||
if os.Getenv("FLAVOR") == "alpine" { | ||
out, _ := machine.Sudo("rc-status") | ||
Expect(out).Should(ContainSubstring("kairos")) | ||
Expect(out).Should(ContainSubstring("kairos-agent")) | ||
} else { | ||
// Eventually(func() string { | ||
// out, _ := machine.SSHCommand("sudo systemctl status kairos-agent") | ||
// return out | ||
// }, 30*time.Second, 10*time.Second).Should(ContainSubstring("no network token")) | ||
|
||
out, _ := machine.Sudo("systemctl status kairos") | ||
Expect(out).Should(ContainSubstring("loaded (/etc/systemd/system/kairos.service; enabled")) | ||
} | ||
}) | ||
}) | ||
|
||
Context("install", func() { | ||
It("to disk with custom config", func() { | ||
err := machine.SendFile("assets/config.yaml", "/tmp/config.yaml", "0770") | ||
Expect(err).ToNot(HaveOccurred()) | ||
|
||
out, _ := machine.Sudo("elemental install --cloud-init /tmp/config.yaml /dev/sda") | ||
Expect(out).Should(ContainSubstring("Running after-install hook")) | ||
fmt.Println(out) | ||
machine.Sudo("sync") | ||
machine.DetachCD() | ||
machine.Restart() | ||
}) | ||
}) | ||
|
||
Context("upgrades", func() { | ||
It("can upgrade to current image", func() { | ||
|
||
currentVersion, err := machine.SSHCommand("source /etc/os-release; echo $VERSION") | ||
Expect(err).ToNot(HaveOccurred()) | ||
Expect(currentVersion).To(ContainSubstring("v")) | ||
_, err = machine.Sudo("kairos-agent") | ||
if err == nil { | ||
out, err := machine.Sudo("kairos-agent upgrade --force --image " + containerImage) | ||
Expect(err).ToNot(HaveOccurred(), string(out)) | ||
Expect(out).To(ContainSubstring("Upgrade completed")) | ||
Expect(out).To(ContainSubstring(containerImage)) | ||
} else { | ||
out, err := machine.Sudo("kairos upgrade --force --image " + containerImage) | ||
Expect(err).ToNot(HaveOccurred(), string(out)) | ||
Expect(out).To(ContainSubstring("Upgrade completed")) | ||
Expect(out).To(ContainSubstring(containerImage)) | ||
} | ||
machine.Sudo("reboot") | ||
machine.EventuallyConnects(750) | ||
|
||
Eventually(func() error { | ||
_, err := machine.SSHCommand("source /etc/os-release; echo $VERSION") | ||
return err | ||
}, 10*time.Minute, 10*time.Second).ShouldNot(HaveOccurred()) | ||
|
||
var v string | ||
Eventually(func() string { | ||
v, _ = machine.SSHCommand("source /etc/os-release; echo $VERSION") | ||
return v | ||
// TODO: Add regex semver check here | ||
}, 10*time.Minute, 10*time.Second).Should(ContainSubstring("v")) | ||
}) | ||
}) | ||
}) |