Documentation ¶
Index ¶
- func AddLink(name string) netlink.Link
- func AddVRFLink(name string, tableId uint32) netlink.Link
- func DelLink(name string)
- func GenerateNAD(networkName, name, namespace, topology, cidr, role string) *nadapi.NetworkAttachmentDefinition
- func GenerateNADWithConfig(name, namespace, config string) *nadapi.NetworkAttachmentDefinition
- func GenerateNADWithoutMTU(networkName, name, namespace, topology, cidr, role string) *nadapi.NetworkAttachmentDefinition
- func MakeReadyEndpoint(node string, addresses ...string) discovery.Endpoint
- func MakeReadyEndpointList(node string, addresses ...string) []discovery.Endpoint
- func MakeTerminatingNonServingEndpoint(node string, addresses ...string) discovery.Endpoint
- func MakeTerminatingServingEndpoint(node string, addresses ...string) discovery.Endpoint
- func MirrorEndpointSlice(defaultEndpointSlice *discovery.EndpointSlice, network string, ...) *discovery.EndpointSlice
- func MustParseIP(ipStr string) net.IP
- func MustParseIPNet(cidrStr string) *net.IPNet
- func MustParseIPNets(ipNetStrs ...string) []*net.IPNet
- func MustParseIPs(ipStrs ...string) []net.IP
- func MustParseMAC(macStr string) net.HardwareAddr
- func NoRoot() bool
- func OnSupportedPlatformsIt(description string, f interface{})
- func ProcessMockFn(mockObj *mock.Mock, mArgs TestifyMockHelper)
- func ProcessMockFnList(mockObj *mock.Mock, mArgs []TestifyMockHelper)
- type AferoDirMockHelper
- type AferoFileMockHelper
- type ExpectedCmd
- type FakeExec
- func (f *FakeExec) AddFakeCmd(expected *ExpectedCmd)
- func (f *FakeExec) AddFakeCmds(commands []*ExpectedCmd)
- func (f *FakeExec) AddFakeCmdsNoOutputNoError(commands []string)
- func (f *FakeExec) CalledMatchesExpected() bool
- func (f *FakeExec) Command(cmd string, args ...string) kexec.Cmd
- func (f *FakeExec) CommandContext(ctx context.Context, cmd string, args ...string) kexec.Cmd
- func (f *FakeExec) ErrorDesc() string
- func (f *FakeExec) LookPath(file string) (string, error)
- type KCmd
- type TestifyMockHelper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateNAD ¶
func GenerateNAD(networkName, name, namespace, topology, cidr, role string) *nadapi.NetworkAttachmentDefinition
func GenerateNADWithConfig ¶
func GenerateNADWithConfig(name, namespace, config string) *nadapi.NetworkAttachmentDefinition
func GenerateNADWithoutMTU ¶
func GenerateNADWithoutMTU(networkName, name, namespace, topology, cidr, role string) *nadapi.NetworkAttachmentDefinition
func MakeReadyEndpoint ¶
func MakeReadyEndpointList ¶
makeReadyEndpointList returns a list of only one endpoint that carries the input addresses.
func MirrorEndpointSlice ¶
func MirrorEndpointSlice(defaultEndpointSlice *discovery.EndpointSlice, network string, keepEndpoints bool) *discovery.EndpointSlice
func MustParseIP ¶
MustParseIP is like net.ParseIP but it panics on error; use this for converting compile-time constant strings to net.IP
func MustParseIPNet ¶
MustParseIPNet is like netlink.ParseIPNet or net.ParseCIDR, except that it panics on error; use this for converting compile-time constant strings to net.IPNet.
func MustParseIPNets ¶
MustParseIPNets is like MustParseIPNet but returns an array of *net.IPNet
func MustParseIPs ¶
MustParseIPs is like MustParseIP but returns an array of net.IP
func MustParseMAC ¶
func MustParseMAC(macStr string) net.HardwareAddr
MustParseMAC is like net.ParseMAC but it panics on error; use this for converting compile-time constant strings to net.HardwareAddr.
func OnSupportedPlatformsIt ¶
func OnSupportedPlatformsIt(description string, f interface{})
OnSupportedPlatformsIt is a wrapper around ginkgo.It to determine if running the test is applicable for the current test environment. This is used to skip tests that are unable to execute in certain environments. Such as those without root or cap_net_admin privileges
func ProcessMockFn ¶
func ProcessMockFn(mockObj *mock.Mock, mArgs TestifyMockHelper)
ProcessMockFn handles mocking of a single method call on a single mock object
func ProcessMockFnList ¶
func ProcessMockFnList(mockObj *mock.Mock, mArgs []TestifyMockHelper)
ProcessMockFnList allows for handling mocking of multiple/differnt method calls on a single mock object
Types ¶
type AferoDirMockHelper ¶
type AferoDirMockHelper struct { DirName string Permissions os.FileMode Files []AferoFileMockHelper }
type AferoFileMockHelper ¶
type ExpectedCmd ¶
type ExpectedCmd struct { // Cmd should be the command-line string of the executable name and all arguments it is expected to be called with Cmd string // LooseBatchCompare should be set if the command-line string is a batched // ovn-nbctl where the ordering does not matter LooseBatchCompare bool // Output is any stdout output which Cmd should produce Output string // Stderr is any stderr output which Cmd should produce Stderr string // Err is any error that should be returned for the invocation of Cmd Err error // Action is run when the fake command is "run" Action func() error // contains filtered or unexported fields }
ExpectedCmd contains properties that the testcase expects a called command to have as well as the output that the fake command should return
type FakeExec ¶
type FakeExec struct {
// contains filtered or unexported fields
}
FakeExec is a convenience struct that wraps testing.FakeExec
func NewFakeExec ¶
func NewFakeExec() *FakeExec
NewFakeExec returns a new FakeExec with a strict order compare
func NewLooseCompareFakeExec ¶
func NewLooseCompareFakeExec() *FakeExec
NewFakeExec returns a new FakeExec with a strict order compare
func (*FakeExec) AddFakeCmd ¶
func (f *FakeExec) AddFakeCmd(expected *ExpectedCmd)
AddFakeCmd takes the ExpectedCmd and appends its runner function to a fake command action list of the FakeExec
func (*FakeExec) AddFakeCmds ¶
func (f *FakeExec) AddFakeCmds(commands []*ExpectedCmd)
func (*FakeExec) AddFakeCmdsNoOutputNoError ¶
AddFakeCmdsNoOutputNoError appends a list of commands to the expected command set. The command cannot return any output or error.
func (*FakeExec) CalledMatchesExpected ¶
CalledMatchesExpected returns true if the number of commands the code under test called matches the number of expected commands in the FakeExec's list
func (*FakeExec) CommandContext ¶
CommandContext wraps arguments into exec.Cmd
type TestifyMockHelper ¶
type TestifyMockHelper struct { // OnCallMethodName - mock method that will be called. // Refer the `Method` field at https://godoc.org/github.com/stretchr/testify/mock#Call OnCallMethodName string // OnCallMethodArgType - argument types of the method that will be called. // Refer the `Arguments` field at https://godoc.org/github.com/stretchr/testify/mock#Call OnCallMethodArgType []string // OnCallMethodArgs - argument values we expect to be passed to the method. // Refer the `Arguments` field at https://godoc.org/github.com/stretchr/testify/mock#Call OnCallMethodArgs []interface{} // RetArgList - arguments returned by mock method when called. // Refer the `ReturnArguments` field at https://godoc.org/github.com/stretchr/testify/mock#Call RetArgList []interface{} // OnCallMethodsArgsStrTypeAppendCount - number of times the `string` type argument is repeated at the end. // NOTE: There are a couple of cases where the ovn related calls take upto 23 string arguments OnCallMethodsArgsStrTypeAppendCount int // CallTimes - number of times to return the return arguments when mock method is called // Refer the `Repeatability` field at https://godoc.org/github.com/stretchr/testify/mock#Call // NOTE: The zero value for an int is 0 in go, however, it the value for 'CallTimes' is not set, we interpret that // it will need to be called once. CallTimes int }
TestifyMockHelper captures the arguments needed for the `On` , `Return` and 'Times` method ( refer https://godoc.org/github.com/stretchr/testify/mock#Call.On , https://godoc.org/github.com/stretchr/testify/mock#Call.Return and https://godoc.org/github.com/stretchr/testify/mock#Call.Times )