Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearTestClientsHolder ¶
func ClearTestClientsHolder()
func SetupFakeOlmClient ¶
SetupFakeOlmClient Overrides the OLM client with the fake interface object for unit testing. Loads the mocking objects so olmv interface methods can find them.
Types ¶
type ClientsHolder ¶
type ClientsHolder struct {
RestConfig *rest.Config
DynamicClient dynamic.Interface
APIExtClient apiextv1.Interface
OlmClient olmClient.Interface
OcpClient clientconfigv1.ConfigV1Interface
K8sClient kubernetes.Interface
K8sNetworkingClient networkingv1.NetworkingV1Interface
MachineCfg ocpMachine.Interface
// contains filtered or unexported fields
}
func GetClientsHolder ¶
func GetClientsHolder(filenames ...string) *ClientsHolder
GetClientsHolder returns the singleton ClientsHolder object.
func GetTestClientsHolder ¶
func GetTestClientsHolder(k8sMockObjects []runtime.Object, filenames ...string) *ClientsHolder
GetTestClientHolder Overwrites the existing clientholders with a mocked version for unit testing. Only pure k8s interfaces will be available. The runtime objects must be pure k8s ones. For other (OLM, ) runtime mocking objects loading, use the proper clientset mocking function.
func (*ClientsHolder) ExecCommandContainer ¶
func (clientsholder *ClientsHolder) ExecCommandContainer( ctx Context, command string) (stdout, stderr string, err error)
ExecCommand runs command in the pod and returns buffer output.
type CommandMock ¶
type CommandMock struct {
// ExecCommandContainerFunc mocks the ExecCommandContainer method.
ExecCommandContainerFunc func(context Context, s string) (string, string, error)
// contains filtered or unexported fields
}
CommandMock is a mock implementation of Command.
func TestSomethingThatUsesCommand(t *testing.T) {
// make and configure a mocked Command
mockedCommand := &CommandMock{
ExecCommandContainerFunc: func(context Context, s string) (string, string, error) {
panic("mock out the ExecCommandContainer method")
},
}
// use mockedCommand in code that requires Command
// and then make assertions.
}
func (*CommandMock) ExecCommandContainer ¶
ExecCommandContainer calls ExecCommandContainerFunc.
func (*CommandMock) ExecCommandContainerCalls ¶
func (mock *CommandMock) ExecCommandContainerCalls() []struct { Context Context S string }
ExecCommandContainerCalls gets all the calls that were made to ExecCommandContainer. Check the length with:
len(mockedCommand.ExecCommandContainerCalls())
type Context ¶
type Context struct {
// contains filtered or unexported fields
}