testutils

package
v2.0.0-...-c1c857e Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: Apache-2.0 Imports: 8 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 FakePlugin

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

func (*FakePlugin) Addr

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

func (*FakePlugin) Client

func (f *FakePlugin) Client() plugin.Client

func (*FakePlugin) Name

func (f *FakePlugin) Name() string

func (*FakePlugin) ScopedPath

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

type FakePluginGetter

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

func (*FakePluginGetter) Get

func (f *FakePluginGetter) Get(name, capability string) (plugin.Plugin, error)

func (*FakePluginGetter) GetAllManagedPluginsByCap

func (f *FakePluginGetter) GetAllManagedPluginsByCap(capability string) []plugin.Plugin

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

Jump to

Keyboard shortcuts

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