Renamed function

This commit is contained in:
Janario Oliveira 2019-09-17 07:30:10 +02:00
parent 439ce51441
commit 2ca213579d
2 changed files with 8 additions and 8 deletions

View File

@ -32,11 +32,11 @@ type FakeMounter struct {
MountCheckErrors map[string]error MountCheckErrors map[string]error
// Some tests run things in parallel, make sure the mounter does not produce // Some tests run things in parallel, make sure the mounter does not produce
// any golang's DATA RACE warnings. // any golang's DATA RACE warnings.
mutex sync.Mutex mutex sync.Mutex
UmountFunc UmountFunc UnmountFunc UnmountFunc
} }
type UmountFunc func(path string) error type UnmountFunc func(path string) error
var _ Interface = &FakeMounter{} var _ Interface = &FakeMounter{}
@ -120,8 +120,8 @@ func (f *FakeMounter) Unmount(target string) error {
newMountpoints := []MountPoint{} newMountpoints := []MountPoint{}
for _, mp := range f.MountPoints { for _, mp := range f.MountPoints {
if mp.Path == absTarget { if mp.Path == absTarget {
if f.UmountFunc != nil { if f.UnmountFunc != nil {
err := f.UmountFunc(absTarget) err := f.UnmountFunc(absTarget)
if err != nil { if err != nil {
return err return err
} }

View File

@ -409,7 +409,7 @@ func TestCleanSubPaths(t *testing.T) {
// Function that validates directory structure after the test // Function that validates directory structure after the test
validate func(base string) error validate func(base string) error
expectError bool expectError bool
umount func(path string) error unmount func(path string) error
}{ }{
{ {
name: "not-exists", name: "not-exists",
@ -557,7 +557,7 @@ func TestCleanSubPaths(t *testing.T) {
} }
return mounts, nil return mounts, nil
}, },
umount: func(mountpath string) error { unmount: func(mountpath string) error {
err := filepath.Walk(mountpath, func(path string, info os.FileInfo, err error) error { err := filepath.Walk(mountpath, func(path string, info os.FileInfo, err error) error {
if path == mountpath { if path == mountpath {
// Skip top level directory // Skip top level directory
@ -593,7 +593,7 @@ func TestCleanSubPaths(t *testing.T) {
t.Fatalf("failed to prepare test %q: %v", test.name, err.Error()) t.Fatalf("failed to prepare test %q: %v", test.name, err.Error())
} }
fm := &mount.FakeMounter{MountPoints: mounts, UmountFunc: test.umount} fm := &mount.FakeMounter{MountPoints: mounts, UnmountFunc: test.unmount}
err = doCleanSubPaths(fm, base, testVol) err = doCleanSubPaths(fm, base, testVol)
if err != nil && !test.expectError { if err != nil && !test.expectError {