Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIUtil ¶
type APIUtil interface { // Create PersistentVolume object CreatePV(pv *v1.PersistentVolume) (*v1.PersistentVolume, error) // Delete PersistentVolume object DeletePV(pvName string) error }
APIUtil is an interface for the K8s API
func NewAPIUtil ¶
func NewAPIUtil(client *kubernetes.Clientset) APIUtil
NewAPIUtil creates a new APIUtil object that represents the K8s API
type FakeAPIUtil ¶
type FakeAPIUtil struct {
// contains filtered or unexported fields
}
FakeAPIUtil is a fake API wrapper for unit testing
func NewFakeAPIUtil ¶
func NewFakeAPIUtil(shouldFail bool, cache *cache.VolumeCache) *FakeAPIUtil
NewFakeAPIUtil returns an APIUtil object that can be used for unit testing
func (*FakeAPIUtil) CreatePV ¶
func (u *FakeAPIUtil) CreatePV(pv *v1.PersistentVolume) (*v1.PersistentVolume, error)
CreatePV will add the PV to the created list and cache
func (*FakeAPIUtil) DeletePV ¶
func (u *FakeAPIUtil) DeletePV(pvName string) error
DeletePV will delete the PV from the created list and cache, and also add it to the deleted list
func (*FakeAPIUtil) GetAndResetCreatedPVs ¶
func (u *FakeAPIUtil) GetAndResetCreatedPVs() map[string]*v1.PersistentVolume
GetAndResetCreatedPVs returns createdPVs and resets the map This is only for testing
func (*FakeAPIUtil) GetAndResetDeletedPVs ¶
func (u *FakeAPIUtil) GetAndResetDeletedPVs() map[string]*v1.PersistentVolume
GetAndResetDeletedPVs returns createdPVs and resets the map This is only for testing
type FakeFile ¶
type FakeFile struct { Name string IsNotDir bool // Expected hash value of the PV name Hash uint32 }
FakeFile contains a representation of a file under a directory
type FakeVolumeUtil ¶
type FakeVolumeUtil struct {
// contains filtered or unexported fields
}
FakeVolumeUtil is a stub interface for unit testing
func NewFakeVolumeUtil ¶
func NewFakeVolumeUtil(deleteShouldFail bool) *FakeVolumeUtil
NewFakeVolumeUtil returns a VolumeUtil object for use in unit testing
func (*FakeVolumeUtil) AddNewFiles ¶
func (u *FakeVolumeUtil) AddNewFiles(mountDir string, dirFiles map[string][]*FakeFile)
AddNewFiles adds the given files to the current directory listing This is only for testing
func (*FakeVolumeUtil) DeleteContents ¶
func (u *FakeVolumeUtil) DeleteContents(fullPath string) error
DeleteContents removes all the contents under the given directory
type VolumeUtil ¶
type VolumeUtil interface { // IsDir checks if the given path is a directory IsDir(fullPath string) (bool, error) // ReadDir returns a list of files under the specified directory ReadDir(fullPath string) ([]string, error) // Delete all the contents under the given path, but not the path itself DeleteContents(fullPath string) error }
VolumeUtil is an interface for local filesystem operations
func NewVolumeUtil ¶
func NewVolumeUtil() VolumeUtil
NewVolumeUtil returns a VolumeUtil object for performing local filesystem operations