Skip to content

Commit

Permalink
Merge pull request #457 from flatcar/kola-regression-test-case
Browse files Browse the repository at this point in the history
kola: Add test case for extra partition creation
  • Loading branch information
jepio authored Nov 23, 2023
2 parents 605ed7c + 054a51c commit 481ef10
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions kola/tests/ignition/filesystem.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/coreos/go-semver/semver"
"github.com/flatcar/mantle/kola/cluster"
"github.com/flatcar/mantle/kola/register"
"github.com/flatcar/mantle/kola/tests/util"
"github.com/flatcar/mantle/platform/conf"
)

Expand Down Expand Up @@ -322,6 +323,17 @@ systemd:
Platforms: []string{"qemu", "qemu-unpriv"},
MinVersion: semver.Version{Major: 3033},
})

register.Register(&register.Test{
// Note: As long as the initrd does not mount /var for early
// preparations, the resulting system has a few issues, so this setup is
// not fully supported yet
Name: "cl.ignition.partition_on_boot_disk",
Run: testPartitionOnBootDisk,
ClusterSize: 0,
Distros: []string{"cl"},
Platforms: []string{"qemu", "qemu-unpriv"},
})
}

var ext4NoClobberV2_1 = conf.Ignition(`{
Expand Down Expand Up @@ -437,3 +449,48 @@ func testSwapActivation(c cluster.TestCluster) {
c.Fatalf("swap's size should be: %s, got %s", swapSize, size)
}
}

var rootDiskExtraPartition = conf.ContainerLinuxConfig(`
storage:
disks:
- device: /dev/disk/by-id/virtio-primary-disk
partitions:
- label: VAR
number: 10
start: '9GiB'
filesystems:
- name: VAR
mount:
device: /dev/disk/by-partlabel/VAR
format: xfs
label: VAR
files:
- filesystem: VAR
path: /hello
mode: 0644
contents:
inline: world
- filesystem: root
path: /etc/fstab
mode: 0644
contents:
inline: |
/dev/disk/by-label/VAR /var xfs defaults 0 0
`)

func testPartitionOnBootDisk(c cluster.TestCluster) {
m, err := util.NewMachineWithLargeDisk(c, "10G", rootDiskExtraPartition)
if err != nil {
c.Fatal(err)
}
out := c.MustSSH(m, "lsblk -f")
c.Logf("lsblk -f:\n%s", out)
out = c.MustSSH(m, "findmnt")
c.Logf("findmnt:\n%s", out)

c.MustSSH(m, "mountpoint /var")
c.MustSSH(m, "ls -la /dev/disk/by-partlabel/VAR")
c.MustSSH(m, "ls -la /dev/disk/by-label/VAR")
c.AssertCmdOutputContains(m, "findmnt /var", "xfs")
c.AssertCmdOutputContains(m, "cat /var/hello", "world")
}

0 comments on commit 481ef10

Please sign in to comment.