mirror of
https://github.com/opencontainers/runc.git
synced 2025-10-15 03:51:12 +08:00
libct/TestFactoryNewTmpfs: benefit from GetMounts
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
@@ -108,26 +108,21 @@ func TestFactoryNewTmpfs(t *testing.T) {
|
|||||||
if !mounted {
|
if !mounted {
|
||||||
t.Fatalf("Factory Root is not mounted")
|
t.Fatalf("Factory Root is not mounted")
|
||||||
}
|
}
|
||||||
mounts, err := mountinfo.GetMounts(nil)
|
mounts, err := mountinfo.GetMounts(mountinfo.SingleEntryFilter(lfactory.Root))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
var found bool
|
if len(mounts) != 1 {
|
||||||
for _, m := range mounts {
|
t.Fatalf("Factory Root is not listed in mounts list")
|
||||||
if m.Mountpoint == lfactory.Root {
|
}
|
||||||
|
m := mounts[0]
|
||||||
if m.Fstype != "tmpfs" {
|
if m.Fstype != "tmpfs" {
|
||||||
t.Fatalf("Fstype of root: %s, expected %s", m.Fstype, "tmpfs")
|
t.Fatalf("Fstype of root: %s, expected %s", m.Fstype, "tmpfs")
|
||||||
}
|
}
|
||||||
if m.Source != "tmpfs" {
|
if m.Source != "tmpfs" {
|
||||||
t.Fatalf("Source of root: %s, expected %s", m.Source, "tmpfs")
|
t.Fatalf("Source of root: %s, expected %s", m.Source, "tmpfs")
|
||||||
}
|
}
|
||||||
found = true
|
unix.Unmount(root, unix.MNT_DETACH)
|
||||||
}
|
|
||||||
}
|
|
||||||
if !found {
|
|
||||||
t.Fatalf("Factory Root is not listed in mounts list")
|
|
||||||
}
|
|
||||||
defer unix.Unmount(root, unix.MNT_DETACH)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestFactoryLoadNotExists(t *testing.T) {
|
func TestFactoryLoadNotExists(t *testing.T) {
|
||||||
|
Reference in New Issue
Block a user