fake

package
v0.0.0-...-3cf8ccf Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Copyright 2022 Matrix Origin

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Package fake is a generated GoMock package.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var KubeClientBuilder = kubefake.NewClientBuilder

Functions

func NewContext

func NewContext[T client.Object](obj T, c client.Client, emitter recon.EventEmitter) *recon.Context[T]

func ReadyPod

func ReadyPod(meta metav1.ObjectMeta) *corev1.Pod

func UnreadyPod

func UnreadyPod(meta metav1.ObjectMeta) *corev1.Pod

Types

type Client

type Client struct {
	Client          client.Client
	MockGet         MockGetFn
	MockList        MockListFn
	MockCreate      MockCreateFn
	MockDelete      MockDeleteFn
	MockDeleteAllOf MockDeleteAllOfFn
	MockUpdate      MockUpdateFn
	MockPatch       MockPatchFn
}

Client proxy the real client.Client and enables us to mock individual funcs when necessary

func NewClient

func NewClient(c client.Client) *Client

func (*Client) Create

func (c *Client) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error

func (*Client) DeleteAllOf

func (c *Client) DeleteAllOf(ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption) error

func (*Client) Get

func (c *Client) Get(ctx context.Context, key client.ObjectKey, obj client.Object) error

func (*Client) List

func (c *Client) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error

func (*Client) Patch

func (c *Client) Patch(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.PatchOption) error

func (*Client) RESTMapper

func (c *Client) RESTMapper() meta.RESTMapper

func (*Client) Scheme

func (c *Client) Scheme() *runtime.Scheme

func (*Client) Status

func (c *Client) Status() client.StatusWriter

func (*Client) Update

func (c *Client) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error

type MockCreateFn

type MockCreateFn func(ctx context.Context, obj runtime.Object, opts ...client.CreateOption) error

func NewMockCreateFn

func NewMockCreateFn(err error, ofn ...ObjectFn) MockCreateFn

type MockDeleteAllOfFn

type MockDeleteAllOfFn func(ctx context.Context, obj runtime.Object, opts ...client.DeleteAllOfOption) error

func NewMockDeleteAllOfFn

func NewMockDeleteAllOfFn(err error, ofn ...ObjectFn) MockDeleteAllOfFn

type MockDeleteFn

type MockDeleteFn func(ctx context.Context, obj runtime.Object, opts ...client.DeleteOption) error

func NewMockDeleteFn

func NewMockDeleteFn(err error, ofn ...ObjectFn) MockDeleteFn

type MockEventEmitter

type MockEventEmitter struct {
	// contains filtered or unexported fields
}

MockEventEmitter is a mock of EventEmitter interface.

func NewMockEventEmitter

func NewMockEventEmitter(ctrl *gomock.Controller) *MockEventEmitter

NewMockEventEmitter creates a new mock instance.

func (*MockEventEmitter) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockEventEmitter) EmitEventGeneric

func (m *MockEventEmitter) EmitEventGeneric(eventReason, msg string, err error)

EmitEventGeneric mocks base method.

func (*MockEventEmitter) EmitEventOnCreate

func (m *MockEventEmitter) EmitEventOnCreate(createObj client.Object, err error)

EmitEventOnCreate mocks base method.

func (*MockEventEmitter) EmitEventOnDelete

func (m *MockEventEmitter) EmitEventOnDelete(deleteObj client.Object, err error)

EmitEventOnDelete mocks base method.

func (*MockEventEmitter) EmitEventOnGetError

func (m *MockEventEmitter) EmitEventOnGetError(getObj client.Object, err error)

EmitEventOnGetError mocks base method.

func (*MockEventEmitter) EmitEventOnList

func (m *MockEventEmitter) EmitEventOnList(listObj client.ObjectList, err error)

EmitEventOnList mocks base method.

func (*MockEventEmitter) EmitEventOnPatch

func (m *MockEventEmitter) EmitEventOnPatch(patchObj client.Object, err error)

EmitEventOnPatch mocks base method.

func (*MockEventEmitter) EmitEventOnUpdate

func (m *MockEventEmitter) EmitEventOnUpdate(updateObj client.Object, err error)

EmitEventOnUpdate mocks base method.

func (*MockEventEmitter) EmitEventRollingDeployWait

func (m *MockEventEmitter) EmitEventRollingDeployWait(k8sObj client.Object)

EmitEventRollingDeployWait mocks base method.

type MockEventEmitterMockRecorder

type MockEventEmitterMockRecorder struct {
	// contains filtered or unexported fields
}

MockEventEmitterMockRecorder is the mock recorder for MockEventEmitter.

func (*MockEventEmitterMockRecorder) EmitEventGeneric

func (mr *MockEventEmitterMockRecorder) EmitEventGeneric(eventReason, msg, err interface{}) *gomock.Call

EmitEventGeneric indicates an expected call of EmitEventGeneric.

func (*MockEventEmitterMockRecorder) EmitEventOnCreate

func (mr *MockEventEmitterMockRecorder) EmitEventOnCreate(createObj, err interface{}) *gomock.Call

EmitEventOnCreate indicates an expected call of EmitEventOnCreate.

func (*MockEventEmitterMockRecorder) EmitEventOnDelete

func (mr *MockEventEmitterMockRecorder) EmitEventOnDelete(deleteObj, err interface{}) *gomock.Call

EmitEventOnDelete indicates an expected call of EmitEventOnDelete.

func (*MockEventEmitterMockRecorder) EmitEventOnGetError

func (mr *MockEventEmitterMockRecorder) EmitEventOnGetError(getObj, err interface{}) *gomock.Call

EmitEventOnGetError indicates an expected call of EmitEventOnGetError.

func (*MockEventEmitterMockRecorder) EmitEventOnList

func (mr *MockEventEmitterMockRecorder) EmitEventOnList(listObj, err interface{}) *gomock.Call

EmitEventOnList indicates an expected call of EmitEventOnList.

func (*MockEventEmitterMockRecorder) EmitEventOnPatch

func (mr *MockEventEmitterMockRecorder) EmitEventOnPatch(patchObj, err interface{}) *gomock.Call

EmitEventOnPatch indicates an expected call of EmitEventOnPatch.

func (*MockEventEmitterMockRecorder) EmitEventOnUpdate

func (mr *MockEventEmitterMockRecorder) EmitEventOnUpdate(updateObj, err interface{}) *gomock.Call

EmitEventOnUpdate indicates an expected call of EmitEventOnUpdate.

func (*MockEventEmitterMockRecorder) EmitEventRollingDeployWait

func (mr *MockEventEmitterMockRecorder) EmitEventRollingDeployWait(k8sObj interface{}) *gomock.Call

EmitEventRollingDeployWait indicates an expected call of EmitEventRollingDeployWait.

type MockGenericEventEmitter

type MockGenericEventEmitter struct {
	// contains filtered or unexported fields
}

MockGenericEventEmitter is a mock of GenericEventEmitter interface.

func NewMockGenericEventEmitter

func NewMockGenericEventEmitter(ctrl *gomock.Controller) *MockGenericEventEmitter

NewMockGenericEventEmitter creates a new mock instance.

func (*MockGenericEventEmitter) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockGenericEventEmitter) EmitEventGeneric

func (m *MockGenericEventEmitter) EmitEventGeneric(eventReason, msg string, err error)

EmitEventGeneric mocks base method.

type MockGenericEventEmitterMockRecorder

type MockGenericEventEmitterMockRecorder struct {
	// contains filtered or unexported fields
}

MockGenericEventEmitterMockRecorder is the mock recorder for MockGenericEventEmitter.

func (*MockGenericEventEmitterMockRecorder) EmitEventGeneric

func (mr *MockGenericEventEmitterMockRecorder) EmitEventGeneric(eventReason, msg, err interface{}) *gomock.Call

EmitEventGeneric indicates an expected call of EmitEventGeneric.

type MockGetFn

type MockGetFn func(ctx context.Context, key client.ObjectKey, obj runtime.Object) error

func NewMockGetFn

func NewMockGetFn(err error, ofn ...ObjectFn) MockGetFn

type MockK8sEventEmitter

type MockK8sEventEmitter struct {
	// contains filtered or unexported fields
}

MockK8sEventEmitter is a mock of K8sEventEmitter interface.

func NewMockK8sEventEmitter

func NewMockK8sEventEmitter(ctrl *gomock.Controller) *MockK8sEventEmitter

NewMockK8sEventEmitter creates a new mock instance.

func (*MockK8sEventEmitter) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockK8sEventEmitter) EmitEventOnCreate

func (m *MockK8sEventEmitter) EmitEventOnCreate(createObj client.Object, err error)

EmitEventOnCreate mocks base method.

func (*MockK8sEventEmitter) EmitEventOnDelete

func (m *MockK8sEventEmitter) EmitEventOnDelete(deleteObj client.Object, err error)

EmitEventOnDelete mocks base method.

func (*MockK8sEventEmitter) EmitEventOnGetError

func (m *MockK8sEventEmitter) EmitEventOnGetError(getObj client.Object, err error)

EmitEventOnGetError mocks base method.

func (*MockK8sEventEmitter) EmitEventOnList

func (m *MockK8sEventEmitter) EmitEventOnList(listObj client.ObjectList, err error)

EmitEventOnList mocks base method.

func (*MockK8sEventEmitter) EmitEventOnPatch

func (m *MockK8sEventEmitter) EmitEventOnPatch(patchObj client.Object, err error)

EmitEventOnPatch mocks base method.

func (*MockK8sEventEmitter) EmitEventOnUpdate

func (m *MockK8sEventEmitter) EmitEventOnUpdate(updateObj client.Object, err error)

EmitEventOnUpdate mocks base method.

func (*MockK8sEventEmitter) EmitEventRollingDeployWait

func (m *MockK8sEventEmitter) EmitEventRollingDeployWait(k8sObj client.Object)

EmitEventRollingDeployWait mocks base method.

type MockK8sEventEmitterMockRecorder

type MockK8sEventEmitterMockRecorder struct {
	// contains filtered or unexported fields
}

MockK8sEventEmitterMockRecorder is the mock recorder for MockK8sEventEmitter.

func (*MockK8sEventEmitterMockRecorder) EmitEventOnCreate

func (mr *MockK8sEventEmitterMockRecorder) EmitEventOnCreate(createObj, err interface{}) *gomock.Call

EmitEventOnCreate indicates an expected call of EmitEventOnCreate.

func (*MockK8sEventEmitterMockRecorder) EmitEventOnDelete

func (mr *MockK8sEventEmitterMockRecorder) EmitEventOnDelete(deleteObj, err interface{}) *gomock.Call

EmitEventOnDelete indicates an expected call of EmitEventOnDelete.

func (*MockK8sEventEmitterMockRecorder) EmitEventOnGetError

func (mr *MockK8sEventEmitterMockRecorder) EmitEventOnGetError(getObj, err interface{}) *gomock.Call

EmitEventOnGetError indicates an expected call of EmitEventOnGetError.

func (*MockK8sEventEmitterMockRecorder) EmitEventOnList

func (mr *MockK8sEventEmitterMockRecorder) EmitEventOnList(listObj, err interface{}) *gomock.Call

EmitEventOnList indicates an expected call of EmitEventOnList.

func (*MockK8sEventEmitterMockRecorder) EmitEventOnPatch

func (mr *MockK8sEventEmitterMockRecorder) EmitEventOnPatch(patchObj, err interface{}) *gomock.Call

EmitEventOnPatch indicates an expected call of EmitEventOnPatch.

func (*MockK8sEventEmitterMockRecorder) EmitEventOnUpdate

func (mr *MockK8sEventEmitterMockRecorder) EmitEventOnUpdate(updateObj, err interface{}) *gomock.Call

EmitEventOnUpdate indicates an expected call of EmitEventOnUpdate.

func (*MockK8sEventEmitterMockRecorder) EmitEventRollingDeployWait

func (mr *MockK8sEventEmitterMockRecorder) EmitEventRollingDeployWait(k8sObj interface{}) *gomock.Call

EmitEventRollingDeployWait indicates an expected call of EmitEventRollingDeployWait.

type MockListFn

type MockListFn func(ctx context.Context, list runtime.Object, opts ...client.ListOption) error

func NewMockListFn

func NewMockListFn(err error, ofn ...ObjectFn) MockListFn

type MockPatchFn

type MockPatchFn func(ctx context.Context, obj runtime.Object, patch client.Patch, opts ...client.PatchOption) error

func NewMockPatchFn

func NewMockPatchFn(err error, ofn ...ObjectFn) MockPatchFn

type MockStatusPatchFn

type MockStatusPatchFn func(ctx context.Context, obj runtime.Object, patch client.Patch, opts ...client.PatchOption) error

type MockStatusUpdateFn

type MockStatusUpdateFn func(ctx context.Context, obj runtime.Object, opts ...client.UpdateOption) error

type MockUpdateFn

type MockUpdateFn func(ctx context.Context, obj runtime.Object, opts ...client.UpdateOption) error

func NewMockUpdateFn

func NewMockUpdateFn(err error, ofn ...ObjectFn) MockUpdateFn

type ObjectFn

type ObjectFn func(obj runtime.Object) error

Jump to

Keyboard shortcuts

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