snapshot: add Close()

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
This commit is contained in:
Akihiro Suda
2017-11-07 08:26:56 +00:00
parent 17093c2f6a
commit 4feb6f228a
13 changed files with 66 additions and 2 deletions

View File

@@ -370,3 +370,8 @@ func (b *snapshotter) Remove(ctx context.Context, key string) (err error) {
return nil
}
// Close closes the snapshotter
func (b *snapshotter) Close() error {
return b.ms.Close()
}

View File

@@ -47,6 +47,9 @@ func boltSnapshotter(t *testing.T) func(context.Context, string) (snapshot.Snaps
}
return snapshotter, func() error {
if err := snapshotter.Close(); err != nil {
return err
}
err := mount.UnmountAll(root, unix.MNT_DETACH)
if cerr := cleanupDevice(); cerr != nil {
err = errors.Wrap(cerr, "device cleanup failed")