Skip to content

Commit

Permalink
kola: Add test case for extra partition creation
Browse files Browse the repository at this point in the history
This is a testcase for a regression that passes until Flatcar 3374 and fails on
Flatcar 3510 (only checked stable releases).

Signed-off-by: Jeremi Piotrowski <[email protected]>
  • Loading branch information
jepio committed Sep 29, 2023
1 parent 929e224 commit 330c799
Showing 1 changed file with 78 additions and 0 deletions.
78 changes: 78 additions & 0 deletions kola/tests/ignition/partitions.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
// Copyright The Mantle Authors
// SPDX-License-Identifier: Apache-2.0
package ignition

import (
"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"
)

const (
userdata = `{
"ignition": { "version": "2.3.0" },
"storage": {
"disks": [
{
"device": "/dev/disk/by-id/virtio-primary-disk",
"partitions": [
{
"label": "VAR",
"number": 10,
"startMiB": 9216
}
]
}
],
"files": [
{
"filesystem": "root",
"path": "/etc/fstab",
"contents": {
"source": "data:,%2Fdev%2Fdisk%2Fby-label%2Fvar%20%2Fvar%20xfs%20defaults%200%200%0A",
"verification": {}
},
"mode": 420
}
],
"filesystems": [
{
"mount": {
"device": "/dev/disk/by-partlabel/VAR",
"format": "xfs",
"label": "var"
},
"name": "var"
}
]
},
"systemd": {}
}`
)

func init() {
register.Register(&register.Test{
Name: "cl.ignition.partitions",
Run: checkPartitions,
ClusterSize: 0,
Distros: []string{"cl"},
Platforms: []string{"qemu", "qemu-unpriv"},
})
}

func checkPartitions(c cluster.TestCluster) {
m, err := util.NewMachineWithLargeDisk(c, "10G", conf.Ignition(userdata))
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")
}

0 comments on commit 330c799

Please sign in to comment.