package testutils

import "github.com/moby/swarmkit/v2/testutils"

Index

Constants

const DockerCSIPluginControllerCap = "csicontroller"
const DockerCSIPluginNodeCap = "csinode"

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.

Source Files

fake_plugingetter.go grpc.go poll.go

Version
v2.0.0-20250103191802-8c1959736554 (latest)
Published
Jan 3, 2025
Platform
linux/amd64
Imports
8 packages
Last checked
4 days ago

Tools for package owners.