Skip to content

Commit

Permalink
[WIP] Test selecting disk by uuid
Browse files Browse the repository at this point in the history
Signed-off-by: Itxaka <itxaka@kairos.io>
  • Loading branch information
Itxaka committed Sep 23, 2024
1 parent 82f80d9 commit 35eb689
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/reusable-build-flavor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ jobs:
--FLAVOR_RELEASE=${{ inputs.flavor_release }} \
--BASE_IMAGE=${{ inputs.base_image }} \
--MODEL=${{ inputs.model }} \
--FAMILY=${{ inputs.family }}
--FAMILY=${{ inputs.family }} --KAIROS_AGENT_DEV_BRANCH=accept_devices
sudo mv build/* .
sudo rm -rf build
- name: Install kairos-agent (for versioneer)
Expand Down
50 changes: 50 additions & 0 deletions tests/install_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,56 @@ var _ = Describe("kairos install test", Label("install-test"), func() {
})

Context("install", func() {
Context("Selecting the disk by uuid/label", func() {
It("Selects the correct disk if using uuid for target", func() {
expectSecureBootEnabled(vm)
// Get uuid of main disk
uuid, err := vm.Sudo("lsblk /dev/vda -o UUID -n")

cc := fmt.Sprintf(`#cloud-config
install:
auto: true
reboot: true
device: /dev/disk/by-uuid/%s
stages:
initramfs:
- name: "Set user and password"
users:
kairos:
passwd: "kairos"
hostname: kairos-{{ trunc 4 .Random }}
`, uuid)

By("Using the following config")
fmt.Fprintf(GinkgoWriter, cc)

t, err := os.CreateTemp("", "test")
ExpectWithOffset(1, err).ToNot(HaveOccurred())

defer os.RemoveAll(t.Name())
err = os.WriteFile(t.Name(), []byte(cc), os.ModePerm)
Expect(err).ToNot(HaveOccurred())

err = vm.Scp(t.Name(), "/tmp/config.yaml", "0770")
Expect(err).ToNot(HaveOccurred())

var out string
By("installing kairos", func() {
out, err = vm.Sudo(`kairos-agent --debug manual-install --device "auto" /tmp/config.yaml`)
Expect(err).ToNot(HaveOccurred(), out)
Expect(out).Should(ContainSubstring("Running after-install hook"))
vm.Sudo("sync")
})

By("waiting for VM to reboot", func() {
vm.Reboot()
vm.EventuallyConnects(1200)
})

expectSecureBootEnabled(vm)
})
})
It("cloud-config syntax mixed with extended syntax", func() {

expectSecureBootEnabled(vm)
Expand Down

0 comments on commit 35eb689

Please sign in to comment.