Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MockDecoder ¶
type MockDecoder struct { // DecodeFunc mocks the Decode method. DecodeFunc func(req admission.Request, into runtime.Object) error // DecodeRawFunc mocks the DecodeRaw method. DecodeRawFunc func(rawObj runtime.RawExtension, into runtime.Object) error // contains filtered or unexported fields }
MockDecoder is a mock implementation of handlers.Decoder.
func TestSomethingThatUsesDecoder(t *testing.T) { // make and configure a mocked handlers.Decoder mockedDecoder := &MockDecoder{ DecodeFunc: func(req admission.Request, into runtime.Object) error { panic("mock out the Decode method") }, DecodeRawFunc: func(rawObj runtime.RawExtension, into runtime.Object) error { panic("mock out the DecodeRaw method") }, } // use mockedDecoder in code that requires handlers.Decoder // and then make assertions. }
func (*MockDecoder) DecodeCalls ¶
func (mock *MockDecoder) DecodeCalls() []struct { Req admission.Request Into runtime.Object }
DecodeCalls gets all the calls that were made to Decode. Check the length with:
len(mockedDecoder.DecodeCalls())
func (*MockDecoder) DecodeRaw ¶
func (mock *MockDecoder) DecodeRaw(rawObj runtime.RawExtension, into runtime.Object) error
DecodeRaw calls DecodeRawFunc.
func (*MockDecoder) DecodeRawCalls ¶
func (mock *MockDecoder) DecodeRawCalls() []struct { RawObj runtime.RawExtension Into runtime.Object }
DecodeRawCalls gets all the calls that were made to DecodeRaw. Check the length with:
len(mockedDecoder.DecodeRawCalls())
type MockHandler ¶
type MockHandler struct { // HandleFunc mocks the Handle method. HandleFunc func(ctx context.Context, pod *corev1.Pod, namespace string) error // contains filtered or unexported fields }
MockHandler is a mock implementation of handlers.K8sHandler.
func TestSomethingThatUsesK8sHandler(t *testing.T) { // make and configure a mocked handlers.K8sHandler mockedK8sHandler := &MockHandler{ HandleFunc: func(ctx context.Context, pod *corev1.Pod, namespace string) error { panic("mock out the Handle method") }, } // use mockedK8sHandler in code that requires handlers.K8sHandler // and then make assertions. }
func (*MockHandler) HandleCalls ¶
func (mock *MockHandler) HandleCalls() []struct { Ctx context.Context Pod *corev1.Pod Namespace string }
HandleCalls gets all the calls that were made to Handle. Check the length with:
len(mockedK8sHandler.HandleCalls())
Click to show internal directories.
Click to hide internal directories.