Cleanup mount after test

This commit is contained in:
Matthieu Rakotojaona 2015-07-19 16:33:37 +02:00
parent d7888d4dd5
commit a4d122e5ae

View file

@ -9,6 +9,8 @@ import (
"testing"
"time"
"bazil.org/fuse"
"github.com/restic/restic"
"github.com/restic/restic/backend"
"github.com/restic/restic/repository"
@ -62,6 +64,15 @@ func TestMount(t *testing.T) {
go cmdMount(t, global, mountpoint, ready)
<-ready
defer func() {
err := fuse.Unmount(mountpoint)
OK(t, err)
if TestCleanup {
err = os.RemoveAll(mountpoint)
OK(t, err)
}
}()
mountpointDir, err := os.Open(mountpoint)
OK(t, err)
names, err := mountpointDir.Readdirnames(-1)