Remove shelling out to mount
Also remove the target from the Mount struct because it should not be used at all. The target can be variable and set by a caller, not by the snapshot drivers. Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
parent
c0fdda03cc
commit
a7a6270f2a
9 changed files with 28 additions and 101 deletions
|
@ -1,24 +1,13 @@
|
|||
package testutil
|
||||
|
||||
import (
|
||||
"os/exec"
|
||||
"syscall"
|
||||
"testing"
|
||||
|
||||
"github.com/docker/containerd"
|
||||
)
|
||||
|
||||
func UnmountAll(t *testing.T, mounts []containerd.Mount) {
|
||||
for _, mount := range mounts {
|
||||
Unmount(t, mount.Target)
|
||||
}
|
||||
}
|
||||
|
||||
func Unmount(t *testing.T, mountPoint string) {
|
||||
t.Log("unmount", mountPoint)
|
||||
umount := exec.Command("umount", mountPoint)
|
||||
err := umount.Run()
|
||||
if err != nil {
|
||||
|
||||
if err := syscall.Unmount(mountPoint, 0); err != nil {
|
||||
t.Error("Could not umount", mountPoint, err)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue