2017-01-13 23:31:21 +00:00
|
|
|
package testutil
|
2017-01-12 01:08:00 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"os/exec"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/docker/containerd"
|
|
|
|
)
|
|
|
|
|
2017-01-13 23:31:21 +00:00
|
|
|
func UnmountAll(t *testing.T, mounts []containerd.Mount) {
|
2017-01-12 01:08:00 +00:00
|
|
|
for _, mount := range mounts {
|
2017-01-13 23:31:21 +00:00
|
|
|
Unmount(t, mount.Target)
|
2017-01-12 01:08:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-13 23:31:21 +00:00
|
|
|
func Unmount(t *testing.T, mountPoint string) {
|
2017-01-12 01:08:00 +00:00
|
|
|
t.Log("unmount", mountPoint)
|
|
|
|
umount := exec.Command("umount", mountPoint)
|
|
|
|
err := umount.Run()
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
t.Error("Could not umount", mountPoint, err)
|
|
|
|
}
|
|
|
|
}
|