type FakeHostUtil … // NewFakeHostUtil returns a struct that implements the HostUtils interface // for testing // TODO: no callers were initializing the struct with any MountPoints. Check // if those are still being used by any callers and if MountPoints still need // to be a part of the struct. func NewFakeHostUtil(fs map[string]FileType) *FakeHostUtil { … } var _ … // DeviceOpened checks if block device referenced by pathname is in use by // checking if is listed as a device in the in-memory mountpoint table. func (hu *FakeHostUtil) DeviceOpened(pathname string) (bool, error) { … } // PathIsDevice always returns true func (hu *FakeHostUtil) PathIsDevice(pathname string) (bool, error) { … } // GetDeviceNameFromMount given a mount point, find the volume id func (hu *FakeHostUtil) GetDeviceNameFromMount(mounter mount.Interface, mountPath, pluginMountDir string) (string, error) { … } // MakeRShared checks if path is shared and bind-mounts it as rshared if needed. // No-op for testing func (hu *FakeHostUtil) MakeRShared(path string) error { … } // GetFileType checks for file/directory/socket/block/character devices. // Defaults to Directory if otherwise unspecified. func (hu *FakeHostUtil) GetFileType(pathname string) (FileType, error) { … } // PathExists checks if pathname exists. func (hu *FakeHostUtil) PathExists(pathname string) (bool, error) { … } // EvalHostSymlinks returns the path name after evaluating symlinks. // No-op for testing func (hu *FakeHostUtil) EvalHostSymlinks(pathname string) (string, error) { … } // GetOwner returns the integer ID for the user and group of the given path // Not implemented for testing func (hu *FakeHostUtil) GetOwner(pathname string) (int64, int64, error) { … } // GetSELinuxSupport tests if pathname is on a mount that supports SELinux. // Not implemented for testing func (hu *FakeHostUtil) GetSELinuxSupport(pathname string) (bool, error) { … } // GetMode returns permissions of pathname. // Not implemented for testing func (hu *FakeHostUtil) GetMode(pathname string) (os.FileMode, error) { … } // GetSELinuxMountContext returns value of -o context=XYZ mount option on // given mount point. func (hu *FakeHostUtil) GetSELinuxMountContext(pathname string) (string, error) { … }