mirror of
https://github.com/moby/moby.git
synced 2025-11-16 22:22:35 +03:00
fix some leaking mounts in tests
This should help with errors such as:
=== RUN TestSysctlOverride
testing.go:1090: TempDir RemoveAll cleanup: unlinkat /tmp/TestSysctlOverride3702360633/001/mounts/shm: device or resource busy
--- FAIL: TestSysctlOverride (0.00s)
=== RUN TestSysctlOverrideHost
testing.go:1090: TempDir RemoveAll cleanup: unlinkat /tmp/TestSysctlOverrideHost226485533/001/mounts/shm: device or resource busy
--- FAIL: TestSysctlOverrideHost (0.00s)
=== RUN TestDockerSuite/TestRunWithVolumesIsRecursive
testing.go:1090: TempDir RemoveAll cleanup: unlinkat /tmp/TestDockerSuiteTestRunWithVolumesIsRecursive1156692230/001/tmpfs: device or resource busy
--- FAIL: TestDockerSuite/TestRunWithVolumesIsRecursive (0.49s)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -2,8 +2,18 @@
|
||||
|
||||
package main
|
||||
|
||||
import "github.com/moby/sys/mount"
|
||||
import (
|
||||
"testing"
|
||||
|
||||
func mountWrapper(device, target, mType, options string) error {
|
||||
return mount.Mount(device, target, mType, options)
|
||||
"github.com/moby/sys/mount"
|
||||
)
|
||||
|
||||
func mountWrapper(t *testing.T, device, target, mType, options string) error {
|
||||
t.Helper()
|
||||
err := mount.Mount(device, target, mType, options)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
t.Cleanup(func() { _ = mount.Unmount(target) })
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user