Skip to content

Commit

Permalink
osbuild: extend TestMountsDeviceFromPtHappy
Browse files Browse the repository at this point in the history
A follow-up to the previous commit. More tests is always nice.

Co-authored-by: Michael Vogt <michael.vogt@gmail.com>
  • Loading branch information
2 people authored and bcl committed May 13, 2024
1 parent d05b34c commit 035481e
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion pkg/osbuild/device_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,14 @@ func TestMountsDeviceFromPtNoRootErrors(t *testing.T) {

func TestMountsDeviceFromPtHappy(t *testing.T) {
filename := "fake-disk.img"
fakePt := testdisk.MakeFakePartitionTable("/")
fakePt := testdisk.MakeFakePartitionTable("/", "/boot", "/boot/efi")
fsRootMntName, mounts, devices, err := genMountsDevicesFromPt(filename, fakePt)
require.Nil(t, err)
assert.Equal(t, fsRootMntName, "-")
assert.Equal(t, mounts, []Mount{
{Name: "-", Type: "org.osbuild.ext4", Source: "-", Target: "/"},
{Name: "boot", Type: "org.osbuild.ext4", Source: "boot", Target: "/boot"},
{Name: "boot-efi", Type: "org.osbuild.fat", Source: "boot-efi", Target: "/boot/efi"},
})
assert.Equal(t, devices, map[string]Device{
"-": {
Expand All @@ -203,5 +205,19 @@ func TestMountsDeviceFromPtHappy(t *testing.T) {
Size: testdisk.FakePartitionSize / 512,
},
},
"boot": {
Type: "org.osbuild.loopback",
Options: &LoopbackDeviceOptions{
Filename: "fake-disk.img",
Size: testdisk.FakePartitionSize / 512,
},
},
"boot-efi": {
Type: "org.osbuild.loopback",
Options: &LoopbackDeviceOptions{
Filename: "fake-disk.img",
Size: testdisk.FakePartitionSize / 512,
},
},
})
}

0 comments on commit 035481e

Please sign in to comment.