testing

package
v1.3.0-beta.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 1, 2016 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindEmptyDirectoryUsageOnTmpfs

func FindEmptyDirectoryUsageOnTmpfs() (*resource.Quantity, error)

FindEmptyDirectoryUsageOnTmpfs finds the expected usage of an empty directory existing on a tmpfs filesystem on this system.

func GetTestVolumePluginMgr added in v1.3.0

func GetTestVolumePluginMgr(
	t *testing.T) (*VolumePluginMgr, *FakeVolumePlugin)

GetTestVolumePluginMgr creates, initializes, and returns a test volume plugin manager and fake volume plugin using a fake volume host.

func NewFakeRecycler

func NewFakeRecycler(pvName string, spec *Spec, host VolumeHost, config VolumeConfig) (Recycler, error)

func NewFakeVolumeHost

func NewFakeVolumeHost(rootDir string, kubeClient clientset.Interface, plugins []VolumePlugin, rootContext string) *fakeVolumeHost

func ProbeVolumePlugins

func ProbeVolumePlugins(config VolumeConfig) []VolumePlugin

func VerifyAttachCallCount added in v1.3.0

func VerifyAttachCallCount(
	expectedAttachCallCount int,
	fakeVolumePlugin *FakeVolumePlugin) error

VerifyAttachCallCount ensures that at least one of the Attachers for this plugin has the expectedAttachCallCount number of calls. Otherwise it returns an error.

func VerifyDetachCallCount added in v1.3.0

func VerifyDetachCallCount(
	expectedDetachCallCount int,
	fakeVolumePlugin *FakeVolumePlugin) error

VerifyDetachCallCount ensures that at least one of the Attachers for this plugin has the expectedDetachCallCount number of calls. Otherwise it returns an error.

func VerifyMountDeviceCallCount added in v1.3.0

func VerifyMountDeviceCallCount(
	expectedMountDeviceCallCount int,
	fakeVolumePlugin *FakeVolumePlugin) error

VerifyMountDeviceCallCount ensures that at least one of the Mounters for this plugin has the expectedMountDeviceCallCount number of calls. Otherwise it returns an error.

func VerifySetUpCallCount added in v1.3.0

func VerifySetUpCallCount(
	expectedSetUpCallCount int,
	fakeVolumePlugin *FakeVolumePlugin) error

VerifySetUpCallCount ensures that at least one of the Mounters for this plugin has the expectedSetUpCallCount number of calls. Otherwise it returns an error.

func VerifyTearDownCallCount added in v1.3.0

func VerifyTearDownCallCount(
	expectedTearDownCallCount int,
	fakeVolumePlugin *FakeVolumePlugin) error

VerifyTearDownCallCount ensures that at least one of the Unounters for this plugin has the expectedTearDownCallCount number of calls. Otherwise it returns an error.

func VerifyWaitForAttachCallCount added in v1.3.0

func VerifyWaitForAttachCallCount(
	expectedWaitForAttachCallCount int,
	fakeVolumePlugin *FakeVolumePlugin) error

VerifyWaitForAttachCallCount ensures that at least one of the Mounters for this plugin has the expectedWaitForAttachCallCount number of calls. Otherwise it returns an error.

func VerifyZeroAttachCalls added in v1.3.0

func VerifyZeroAttachCalls(fakeVolumePlugin *FakeVolumePlugin) error

VerifyZeroAttachCalls ensures that all of the Attachers for this plugin have a zero AttachCallCount. Otherwise it returns an error.

func VerifyZeroDetachCallCount added in v1.3.0

func VerifyZeroDetachCallCount(fakeVolumePlugin *FakeVolumePlugin) error

VerifyZeroDetachCallCount ensures that all Detachers for this plugin have a zero DetachCallCount. Otherwise it returns an error.

func VerifyZeroMountDeviceCallCount added in v1.3.0

func VerifyZeroMountDeviceCallCount(fakeVolumePlugin *FakeVolumePlugin) error

VerifyZeroMountDeviceCallCount ensures that all Attachers for this plugin have a zero MountDeviceCallCount. Otherwise it returns an error.

func VerifyZeroSetUpCallCount added in v1.3.0

func VerifyZeroSetUpCallCount(fakeVolumePlugin *FakeVolumePlugin) error

VerifyZeroSetUpCallCount ensures that all Mounters for this plugin have a zero SetUpCallCount. Otherwise it returns an error.

func VerifyZeroTearDownCallCount added in v1.3.0

func VerifyZeroTearDownCallCount(fakeVolumePlugin *FakeVolumePlugin) error

VerifyZeroTearDownCallCount ensures that all Mounters for this plugin have a zero TearDownCallCount. Otherwise it returns an error.

func VerifyZeroWaitForAttachCallCount added in v1.3.0

func VerifyZeroWaitForAttachCallCount(fakeVolumePlugin *FakeVolumePlugin) error

VerifyZeroWaitForAttachCallCount ensures that all Attachers for this plugin have a zero WaitForAttachCallCount. Otherwise it returns an error.

Types

type FakeDeleter

type FakeDeleter struct {
	MetricsNil
	// contains filtered or unexported fields
}

func (*FakeDeleter) Delete

func (fd *FakeDeleter) Delete() error

func (*FakeDeleter) GetPath

func (fd *FakeDeleter) GetPath() string

type FakeProvisioner

type FakeProvisioner struct {
	Options VolumeOptions
	Host    VolumeHost
}

func (*FakeProvisioner) Provision

func (fc *FakeProvisioner) Provision() (*api.PersistentVolume, error)

type FakeVolume

type FakeVolume struct {
	sync.RWMutex
	PodUID  types.UID
	VolName string
	Plugin  *FakeVolumePlugin
	MetricsNil

	SetUpCallCount              int
	TearDownCallCount           int
	AttachCallCount             int
	DetachCallCount             int
	WaitForAttachCallCount      int
	WaitForDetachCallCount      int
	MountDeviceCallCount        int
	UnmountDeviceCallCount      int
	GetDeviceMountPathCallCount int
}

func (*FakeVolume) Attach

func (fv *FakeVolume) Attach(spec *Spec, hostName string) (string, error)

func (*FakeVolume) Detach

func (fv *FakeVolume) Detach(deviceMountPath string, hostName string) error

func (*FakeVolume) GetAttachCallCount added in v1.3.0

func (fv *FakeVolume) GetAttachCallCount() int

func (*FakeVolume) GetAttributes

func (_ *FakeVolume) GetAttributes() Attributes

func (*FakeVolume) GetDetachCallCount added in v1.3.0

func (fv *FakeVolume) GetDetachCallCount() int

func (*FakeVolume) GetDeviceMountPath added in v1.3.0

func (fv *FakeVolume) GetDeviceMountPath(spec *Spec) (string, error)

func (*FakeVolume) GetMountDeviceCallCount added in v1.3.0

func (fv *FakeVolume) GetMountDeviceCallCount() int

func (*FakeVolume) GetPath

func (fv *FakeVolume) GetPath() string

func (*FakeVolume) GetSetUpCallCount added in v1.3.0

func (fv *FakeVolume) GetSetUpCallCount() int

func (*FakeVolume) GetTearDownCallCount added in v1.3.0

func (fv *FakeVolume) GetTearDownCallCount() int

func (*FakeVolume) GetWaitForAttachCallCount added in v1.3.0

func (fv *FakeVolume) GetWaitForAttachCallCount() int

func (*FakeVolume) MountDevice added in v1.3.0

func (fv *FakeVolume) MountDevice(spec *Spec, devicePath string, deviceMountPath string) error

func (*FakeVolume) SetUp

func (fv *FakeVolume) SetUp(fsGroup *int64) error

func (*FakeVolume) SetUpAt

func (fv *FakeVolume) SetUpAt(dir string, fsGroup *int64) error

func (*FakeVolume) TearDown

func (fv *FakeVolume) TearDown() error

func (*FakeVolume) TearDownAt

func (fv *FakeVolume) TearDownAt(dir string) error

func (*FakeVolume) UnmountDevice added in v1.3.0

func (fv *FakeVolume) UnmountDevice(globalMountPath string) error

func (*FakeVolume) WaitForAttach added in v1.3.0

func (fv *FakeVolume) WaitForAttach(spec *Spec, devicePath string, spectimeout time.Duration) (string, error)

func (*FakeVolume) WaitForDetach added in v1.3.0

func (fv *FakeVolume) WaitForDetach(devicePath string, timeout time.Duration) error

type FakeVolumePlugin

type FakeVolumePlugin struct {
	sync.RWMutex
	PluginName             string
	Host                   VolumeHost
	Config                 VolumeConfig
	LastProvisionerOptions VolumeOptions
	NewAttacherCallCount   int
	NewDetacherCallCount   int

	Mounters   []*FakeVolume
	Unmounters []*FakeVolume
	Attachers  []*FakeVolume
	Detachers  []*FakeVolume
}

FakeVolumePlugin is useful for testing. It tries to be a fully compliant plugin, but all it does is make empty directories. Use as:

volume.RegisterPlugin(&FakePlugin{"fake-name"})

func (*FakeVolumePlugin) CanSupport

func (plugin *FakeVolumePlugin) CanSupport(spec *Spec) bool

func (*FakeVolumePlugin) GetAccessModes

func (plugin *FakeVolumePlugin) GetAccessModes() []api.PersistentVolumeAccessMode

func (*FakeVolumePlugin) GetAttachers added in v1.3.0

func (plugin *FakeVolumePlugin) GetAttachers() (Attachers []*FakeVolume)

func (*FakeVolumePlugin) GetDetachers added in v1.3.0

func (plugin *FakeVolumePlugin) GetDetachers() (Detachers []*FakeVolume)

func (*FakeVolumePlugin) GetMounters added in v1.3.0

func (plugin *FakeVolumePlugin) GetMounters() (Mounters []*FakeVolume)

func (*FakeVolumePlugin) GetNewAttacherCallCount added in v1.3.0

func (plugin *FakeVolumePlugin) GetNewAttacherCallCount() int

func (*FakeVolumePlugin) GetNewDetacherCallCount added in v1.3.0

func (plugin *FakeVolumePlugin) GetNewDetacherCallCount() int

func (*FakeVolumePlugin) GetPluginName added in v1.3.0

func (plugin *FakeVolumePlugin) GetPluginName() string

func (*FakeVolumePlugin) GetUnmounters added in v1.3.0

func (plugin *FakeVolumePlugin) GetUnmounters() (Unmounters []*FakeVolume)

func (*FakeVolumePlugin) GetVolumeName added in v1.3.0

func (plugin *FakeVolumePlugin) GetVolumeName(spec *Spec) (string, error)

func (*FakeVolumePlugin) Init

func (plugin *FakeVolumePlugin) Init(host VolumeHost) error

func (*FakeVolumePlugin) NewAttacher

func (plugin *FakeVolumePlugin) NewAttacher() (Attacher, error)

func (*FakeVolumePlugin) NewDeleter

func (plugin *FakeVolumePlugin) NewDeleter(spec *Spec) (Deleter, error)

func (*FakeVolumePlugin) NewDetacher

func (plugin *FakeVolumePlugin) NewDetacher() (Detacher, error)

func (*FakeVolumePlugin) NewMounter added in v1.3.0

func (plugin *FakeVolumePlugin) NewMounter(spec *Spec, pod *api.Pod, opts VolumeOptions) (Mounter, error)

func (*FakeVolumePlugin) NewProvisioner

func (plugin *FakeVolumePlugin) NewProvisioner(options VolumeOptions) (Provisioner, error)

func (*FakeVolumePlugin) NewRecycler

func (plugin *FakeVolumePlugin) NewRecycler(pvName string, spec *Spec) (Recycler, error)

func (*FakeVolumePlugin) NewUnmounter added in v1.3.0

func (plugin *FakeVolumePlugin) NewUnmounter(volName string, podUID types.UID) (Unmounter, error)

func (*FakeVolumePlugin) RequiresRemount added in v1.3.0

func (plugin *FakeVolumePlugin) RequiresRemount() bool

type MockVolume

type MockVolume struct {
	mock.Mock
}

func (*MockVolume) GetMetrics

func (_m *MockVolume) GetMetrics() (*Metrics, error)

GetMetrics provides a mock function with given fields:

func (*MockVolume) GetPath

func (_m *MockVolume) GetPath() string

GetPath provides a mock function with given fields:

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL