testutils

package
v1.12.1-0...-676f45f Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const DockerCSIPluginControllerCap = "csicontroller"
View Source
const DockerCSIPluginNodeCap = "csinode"

Variables

This section is empty.

Functions

func ErrorCode

func ErrorCode(err error) codes.Code

ErrorCode returns the error code for err if it was produced by the rpc system. Otherwise, it returns codes.Unknown.

func ErrorDesc

func ErrorDesc(err error) string

ErrorDesc returns the error description of err if it was produced by the rpc system. Otherwise, it returns err.Error() or empty string when err is nil.

func PollFunc

func PollFunc(clockSource *fakeclock.FakeClock, f func() error) error

PollFunc is like PollFuncWithTimeout with timeout=10s.

func PollFuncWithTimeout

func PollFuncWithTimeout(clockSource *fakeclock.FakeClock, f func() error, timeout time.Duration) error

PollFuncWithTimeout is used to periodically execute a check function, it returns error after timeout.

Types

type FakeCompatPlugin

type FakeCompatPlugin struct {
	PluginName string
	PluginAddr net.Addr
	Scope      string
}

fakeCompatPlugin is a fake implementing the plugingetter.CompatPlugin and plugingetter.PluginAddr interfaces

func (*FakeCompatPlugin) Addr

func (f *FakeCompatPlugin) Addr() net.Addr

func (*FakeCompatPlugin) Client

func (f *FakeCompatPlugin) Client() *plugins.Client

func (*FakeCompatPlugin) IsV1

func (f *FakeCompatPlugin) IsV1() bool

func (*FakeCompatPlugin) Name

func (f *FakeCompatPlugin) Name() string

func (*FakeCompatPlugin) Protocol

func (f *FakeCompatPlugin) Protocol() string

func (*FakeCompatPlugin) ScopedPath

func (f *FakeCompatPlugin) ScopedPath(path string) string

func (*FakeCompatPlugin) Timeout

func (f *FakeCompatPlugin) Timeout() time.Duration

type FakePluginGetter

type FakePluginGetter struct {
	Plugins map[string]*FakeCompatPlugin
}

func (*FakePluginGetter) Get

func (f *FakePluginGetter) Get(name, capability string, _ int) (plugingetter.CompatPlugin, error)

func (*FakePluginGetter) GetAllByCap

func (f *FakePluginGetter) GetAllByCap(_ string) ([]plugingetter.CompatPlugin, error)

GetAllByCap is not needed in the fake and is unimplemented

func (*FakePluginGetter) GetAllManagedPluginsByCap

func (f *FakePluginGetter) GetAllManagedPluginsByCap(capability string) []plugingetter.CompatPlugin

GetAllManagedPluginsByCap returns all of the fake's plugins. If capability is anything other than DockerCSIPluginCap, it returns nothing.

func (*FakePluginGetter) Handle

func (f *FakePluginGetter) Handle(_ string, _ func(string, *plugins.Client))

Handle is not needed in the fake, so is unimplemented.

Jump to

Keyboard shortcuts

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