disk: add basic check for ForEachEntity
Assure that we visit all the entities. Co-Authored-By: Achilleas Koutsou <achilleas@koutsou.net>
This commit is contained in:
parent
cea96c43ac
commit
26c7be5311
1 changed files with 18 additions and 0 deletions
|
|
@ -154,3 +154,21 @@ func TestDisk_ForEachFilesystem(t *testing.T) {
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, []*Filesystem{bootFs}, expectedFilesystems)
|
assert.Equal(t, []*Filesystem{bootFs}, expectedFilesystems)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestDisk_ForEachEntity(t *testing.T) {
|
||||||
|
|
||||||
|
count := 0
|
||||||
|
err := canonicalPartitionTable.ForEachEntity(func(e Entity, path []Entity) error {
|
||||||
|
assert.NotNil(t, e)
|
||||||
|
assert.NotNil(t, path)
|
||||||
|
|
||||||
|
count += 1
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
|
||||||
|
assert.NoError(t, err)
|
||||||
|
|
||||||
|
// PartitionTable, 4 partitions, 3 filesystems -> 8 entities
|
||||||
|
assert.Equal(t, 8, count)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue