mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
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>
20 lines
327 B
Go
20 lines
327 B
Go
//go:build !windows
|
|
|
|
package main
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"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
|
|
}
|