Documentation ¶
Index ¶
- Variables
- func NewTestingEventLoop(emitter TestingSnapshotEmitter, syncer TestingSyncer) eventloop.EventLoop
- func NewTestingSimpleEventLoop(emitter TestingSimpleEmitter, syncers ...TestingSyncer) eventloop.SimpleEventLoop
- type FakeResource
- func (o *FakeResource) DeepCopyInto(out *FakeResource)
- func (o *FakeResource) DeepCopyObject() runtime.Object
- func (*FakeResource) Descriptor() ([]byte, []int)deprecated
- func (m *FakeResource) Equal(that interface{}) bool
- func (x *FakeResource) GetCount() uint32
- func (x *FakeResource) GetMetadata() *core.Metadata
- func (o *FakeResource) GetObjectKind() schema.ObjectKind
- func (r *FakeResource) GroupVersionKind() schema.GroupVersionKind
- func (m *FakeResource) Hash(hasher hash.Hash64) (uint64, error)
- func (r *FakeResource) MustHash() uint64
- func (*FakeResource) ProtoMessage()
- func (x *FakeResource) ProtoReflect() protoreflect.Message
- func (x *FakeResource) Reset()
- func (r *FakeResource) SetMetadata(meta *core.Metadata)
- func (x *FakeResource) String() string
- type FakeResourceClient
- func NewFakeResourceClient(ctx context.Context, rcFactory factory.ResourceClientFactory) (FakeResourceClient, error)
- func NewFakeResourceClientWithBase(rc clients.ResourceClient) FakeResourceClient
- func NewFakeResourceClientWithToken(ctx context.Context, rcFactory factory.ResourceClientFactory, token string) (FakeResourceClient, error)
- type FakeResourceList
- func (list FakeResourceList) AsInterfaces() []interface{}
- func (list FakeResourceList) AsResources() resources.ResourceList
- func (list FakeResourceList) Clone() FakeResourceList
- func (list FakeResourceList) Each(f func(element *FakeResource))
- func (list FakeResourceList) EachResource(f func(element resources.Resource))
- func (list FakeResourceList) Find(namespace, name string) (*FakeResource, error)
- func (list FakeResourceList) Names() []string
- func (list FakeResourceList) NamespacesDotNames() []string
- func (list FakeResourceList) Sort() FakeResourceList
- type FakeResourceReconciler
- type FakeResourceWatcher
- type MockResource
- func (o *MockResource) DeepCopyInto(out *MockResource)
- func (o *MockResource) DeepCopyObject() runtime.Object
- func (*MockResource) Descriptor() ([]byte, []int)deprecated
- func (m *MockResource) Equal(that interface{}) bool
- func (x *MockResource) GetData() string
- func (x *MockResource) GetMetadata() *core.Metadata
- func (x *MockResource) GetNamespacedStatuses() *core.NamespacedStatuses
- func (o *MockResource) GetObjectKind() schema.ObjectKind
- func (x *MockResource) GetOneofOne() string
- func (x *MockResource) GetOneofTwo() bool
- func (x *MockResource) GetSomeDumbField() string
- func (r *MockResource) GetStatus() *core.Status
- func (m *MockResource) GetTestOneofFields() isMockResource_TestOneofFields
- func (r *MockResource) GroupVersionKind() schema.GroupVersionKind
- func (m *MockResource) Hash(hasher hash.Hash64) (uint64, error)
- func (r *MockResource) MustHash() uint64
- func (*MockResource) ProtoMessage()
- func (x *MockResource) ProtoReflect() protoreflect.Message
- func (x *MockResource) Reset()
- func (r *MockResource) SetMetadata(meta *core.Metadata)
- func (r *MockResource) SetNamespacedStatuses(namespacedStatuses *core.NamespacedStatuses)
- func (r *MockResource) SetStatus(status *core.Status)
- func (x *MockResource) String() string
- type MockResourceClient
- func NewMockResourceClient(ctx context.Context, rcFactory factory.ResourceClientFactory) (MockResourceClient, error)
- func NewMockResourceClientWithBase(rc clients.ResourceClient) MockResourceClient
- func NewMockResourceClientWithToken(ctx context.Context, rcFactory factory.ResourceClientFactory, token string) (MockResourceClient, error)
- type MockResourceList
- func (list MockResourceList) AsInputResources() resources.InputResourceList
- func (list MockResourceList) AsInterfaces() []interface{}
- func (list MockResourceList) AsResources() resources.ResourceList
- func (list MockResourceList) Clone() MockResourceList
- func (list MockResourceList) Each(f func(element *MockResource))
- func (list MockResourceList) EachResource(f func(element resources.Resource))
- func (list MockResourceList) Find(namespace, name string) (*MockResource, error)
- func (list MockResourceList) Names() []string
- func (list MockResourceList) NamespacesDotNames() []string
- func (list MockResourceList) Sort() MockResourceList
- type MockResourceReconciler
- type MockResourceWatcher
- type MockResource_OneofOne
- type MockResource_OneofTwo
- type TestingEmitter
- type TestingSimpleEmitter
- type TestingSnapshot
- type TestingSnapshotEmitter
- type TestingSnapshotStringer
- type TestingSyncDeciderdeprecated
- type TestingSyncDeciderWithContext
- type TestingSyncer
- type TestingSyncers
- type TransitionFakeResourceFunc
- type TransitionMockResourceFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ( FakeResourceCrd = crd.NewCrd( "fakes", FakeResourceGVK.Group, FakeResourceGVK.Version, FakeResourceGVK.Kind, "fk", false, &FakeResource{}) )
View Source
var (
FakeResourceGVK = schema.GroupVersionKind{
Version: "v1alpha1",
Group: "crds.testing.solo.io",
Kind: "FakeResource",
}
)
View Source
var File_github_com_solo_io_solo_kit_test_mocks_api_v1alpha1_mock_resources_proto protoreflect.FileDescriptor
View Source
var ( MockResourceCrd = crd.NewCrd( "mocks", MockResourceGVK.Group, MockResourceGVK.Version, MockResourceGVK.Kind, "mk", false, &MockResource{}) )
View Source
var (
MockResourceGVK = schema.GroupVersionKind{
Version: "v1alpha1",
Group: "crds.testing.solo.io",
Kind: "MockResource",
}
)
Functions ¶
func NewTestingEventLoop ¶
func NewTestingEventLoop(emitter TestingSnapshotEmitter, syncer TestingSyncer) eventloop.EventLoop
func NewTestingSimpleEventLoop ¶
func NewTestingSimpleEventLoop(emitter TestingSimpleEmitter, syncers ...TestingSyncer) eventloop.SimpleEventLoop
Types ¶
type FakeResource ¶
type FakeResource struct { Count uint32 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` Metadata *core.Metadata `protobuf:"bytes,7,opt,name=metadata,proto3" json:"metadata,omitempty"` // contains filtered or unexported fields }
func NewFakeResource ¶
func NewFakeResource(namespace, name string) *FakeResource
func (*FakeResource) DeepCopyInto ¶ added in v0.11.3
func (o *FakeResource) DeepCopyInto(out *FakeResource)
func (*FakeResource) DeepCopyObject ¶
func (o *FakeResource) DeepCopyObject() runtime.Object
func (*FakeResource) Descriptor
deprecated
func (*FakeResource) Descriptor() ([]byte, []int)
Deprecated: Use FakeResource.ProtoReflect.Descriptor instead.
func (*FakeResource) GetCount ¶
func (x *FakeResource) GetCount() uint32
func (*FakeResource) GetMetadata ¶
func (x *FakeResource) GetMetadata() *core.Metadata
func (*FakeResource) GetObjectKind ¶
func (o *FakeResource) GetObjectKind() schema.ObjectKind
func (*FakeResource) GroupVersionKind ¶ added in v0.10.4
func (r *FakeResource) GroupVersionKind() schema.GroupVersionKind
func (*FakeResource) Hash ¶
func (m *FakeResource) Hash(hasher hash.Hash64) (uint64, error)
Hash function
func (*FakeResource) MustHash ¶ added in v0.11.16
func (r *FakeResource) MustHash() uint64
func (*FakeResource) ProtoMessage ¶
func (*FakeResource) ProtoMessage()
func (*FakeResource) ProtoReflect ¶ added in v0.16.0
func (x *FakeResource) ProtoReflect() protoreflect.Message
func (*FakeResource) Reset ¶
func (x *FakeResource) Reset()
func (*FakeResource) SetMetadata ¶
func (r *FakeResource) SetMetadata(meta *core.Metadata)
func (*FakeResource) String ¶
func (x *FakeResource) String() string
type FakeResourceClient ¶
type FakeResourceClient interface { BaseClient() clients.ResourceClient Register() error Read(namespace, name string, opts clients.ReadOpts) (*FakeResource, error) Write(resource *FakeResource, opts clients.WriteOpts) (*FakeResource, error) Delete(namespace, name string, opts clients.DeleteOpts) error List(namespace string, opts clients.ListOpts) (FakeResourceList, error) FakeResourceWatcher }
func NewFakeResourceClient ¶
func NewFakeResourceClient(ctx context.Context, rcFactory factory.ResourceClientFactory) (FakeResourceClient, error)
func NewFakeResourceClientWithBase ¶
func NewFakeResourceClientWithBase(rc clients.ResourceClient) FakeResourceClient
func NewFakeResourceClientWithToken ¶
func NewFakeResourceClientWithToken(ctx context.Context, rcFactory factory.ResourceClientFactory, token string) (FakeResourceClient, error)
type FakeResourceList ¶
type FakeResourceList []*FakeResource
func (FakeResourceList) AsInterfaces ¶
func (list FakeResourceList) AsInterfaces() []interface{}
func (FakeResourceList) AsResources ¶
func (list FakeResourceList) AsResources() resources.ResourceList
func (FakeResourceList) Clone ¶
func (list FakeResourceList) Clone() FakeResourceList
func (FakeResourceList) Each ¶
func (list FakeResourceList) Each(f func(element *FakeResource))
func (FakeResourceList) EachResource ¶
func (list FakeResourceList) EachResource(f func(element resources.Resource))
func (FakeResourceList) Find ¶
func (list FakeResourceList) Find(namespace, name string) (*FakeResource, error)
func (FakeResourceList) Names ¶
func (list FakeResourceList) Names() []string
func (FakeResourceList) NamespacesDotNames ¶
func (list FakeResourceList) NamespacesDotNames() []string
func (FakeResourceList) Sort ¶
func (list FakeResourceList) Sort() FakeResourceList
type FakeResourceReconciler ¶
type FakeResourceReconciler interface {
Reconcile(namespace string, desiredResources FakeResourceList, transition TransitionFakeResourceFunc, opts clients.ListOpts) error
}
func NewFakeResourceReconciler ¶
func NewFakeResourceReconciler(client FakeResourceClient, statusSetter resources.StatusSetter) FakeResourceReconciler
type FakeResourceWatcher ¶
type MockResource ¶
type MockResource struct { NamespacedStatuses *core.NamespacedStatuses `protobuf:"bytes,16,opt,name=namespaced_statuses,json=namespacedStatuses,proto3" json:"namespaced_statuses,omitempty"` Metadata *core.Metadata `protobuf:"bytes,7,opt,name=metadata,proto3" json:"metadata,omitempty"` Data string `protobuf:"bytes,1,opt,name=data,json=data.json,proto3" json:"data,omitempty"` SomeDumbField string `protobuf:"bytes,100,opt,name=some_dumb_field,json=someDumbField,proto3" json:"some_dumb_field,omitempty"` // Types that are assignable to TestOneofFields: // *MockResource_OneofOne // *MockResource_OneofTwo TestOneofFields isMockResource_TestOneofFields `protobuf_oneof:"test_oneof_fields"` // contains filtered or unexported fields }
Mock resources for goofin off
func NewMockResource ¶
func NewMockResource(namespace, name string) *MockResource
func (*MockResource) DeepCopyInto ¶ added in v0.11.3
func (o *MockResource) DeepCopyInto(out *MockResource)
func (*MockResource) DeepCopyObject ¶
func (o *MockResource) DeepCopyObject() runtime.Object
func (*MockResource) Descriptor
deprecated
func (*MockResource) Descriptor() ([]byte, []int)
Deprecated: Use MockResource.ProtoReflect.Descriptor instead.
func (*MockResource) GetData ¶
func (x *MockResource) GetData() string
func (*MockResource) GetMetadata ¶
func (x *MockResource) GetMetadata() *core.Metadata
func (*MockResource) GetNamespacedStatuses ¶ added in v0.23.0
func (x *MockResource) GetNamespacedStatuses() *core.NamespacedStatuses
func (*MockResource) GetObjectKind ¶
func (o *MockResource) GetObjectKind() schema.ObjectKind
func (*MockResource) GetOneofOne ¶
func (x *MockResource) GetOneofOne() string
func (*MockResource) GetOneofTwo ¶
func (x *MockResource) GetOneofTwo() bool
func (*MockResource) GetSomeDumbField ¶
func (x *MockResource) GetSomeDumbField() string
func (*MockResource) GetTestOneofFields ¶
func (m *MockResource) GetTestOneofFields() isMockResource_TestOneofFields
func (*MockResource) GroupVersionKind ¶ added in v0.10.4
func (r *MockResource) GroupVersionKind() schema.GroupVersionKind
func (*MockResource) Hash ¶
func (m *MockResource) Hash(hasher hash.Hash64) (uint64, error)
Hash function
func (*MockResource) MustHash ¶ added in v0.11.16
func (r *MockResource) MustHash() uint64
func (*MockResource) ProtoMessage ¶
func (*MockResource) ProtoMessage()
func (*MockResource) ProtoReflect ¶ added in v0.16.0
func (x *MockResource) ProtoReflect() protoreflect.Message
func (*MockResource) Reset ¶
func (x *MockResource) Reset()
func (*MockResource) SetMetadata ¶
func (r *MockResource) SetMetadata(meta *core.Metadata)
func (*MockResource) SetNamespacedStatuses ¶ added in v0.23.0
func (r *MockResource) SetNamespacedStatuses(namespacedStatuses *core.NamespacedStatuses)
func (*MockResource) String ¶
func (x *MockResource) String() string
type MockResourceClient ¶
type MockResourceClient interface { BaseClient() clients.ResourceClient Register() error Read(namespace, name string, opts clients.ReadOpts) (*MockResource, error) Write(resource *MockResource, opts clients.WriteOpts) (*MockResource, error) Delete(namespace, name string, opts clients.DeleteOpts) error List(namespace string, opts clients.ListOpts) (MockResourceList, error) MockResourceWatcher }
func NewMockResourceClient ¶
func NewMockResourceClient(ctx context.Context, rcFactory factory.ResourceClientFactory) (MockResourceClient, error)
func NewMockResourceClientWithBase ¶
func NewMockResourceClientWithBase(rc clients.ResourceClient) MockResourceClient
func NewMockResourceClientWithToken ¶
func NewMockResourceClientWithToken(ctx context.Context, rcFactory factory.ResourceClientFactory, token string) (MockResourceClient, error)
type MockResourceList ¶
type MockResourceList []*MockResource
func (MockResourceList) AsInputResources ¶
func (list MockResourceList) AsInputResources() resources.InputResourceList
func (MockResourceList) AsInterfaces ¶
func (list MockResourceList) AsInterfaces() []interface{}
func (MockResourceList) AsResources ¶
func (list MockResourceList) AsResources() resources.ResourceList
func (MockResourceList) Clone ¶
func (list MockResourceList) Clone() MockResourceList
func (MockResourceList) Each ¶
func (list MockResourceList) Each(f func(element *MockResource))
func (MockResourceList) EachResource ¶
func (list MockResourceList) EachResource(f func(element resources.Resource))
func (MockResourceList) Find ¶
func (list MockResourceList) Find(namespace, name string) (*MockResource, error)
func (MockResourceList) Names ¶
func (list MockResourceList) Names() []string
func (MockResourceList) NamespacesDotNames ¶
func (list MockResourceList) NamespacesDotNames() []string
func (MockResourceList) Sort ¶
func (list MockResourceList) Sort() MockResourceList
type MockResourceReconciler ¶
type MockResourceReconciler interface {
Reconcile(namespace string, desiredResources MockResourceList, transition TransitionMockResourceFunc, opts clients.ListOpts) error
}
func NewMockResourceReconciler ¶
func NewMockResourceReconciler(client MockResourceClient, statusSetter resources.StatusSetter) MockResourceReconciler
type MockResourceWatcher ¶
type MockResource_OneofOne ¶
type MockResource_OneofOne struct {
OneofOne string `protobuf:"bytes,3,opt,name=oneof_one,json=oneofOne,proto3,oneof"`
}
type MockResource_OneofTwo ¶
type MockResource_OneofTwo struct {
OneofTwo bool `protobuf:"varint,2,opt,name=oneof_two,json=oneofTwo,proto3,oneof"`
}
type TestingEmitter ¶
type TestingEmitter interface { TestingSnapshotEmitter Register() error MockResource() MockResourceClient }
func NewTestingEmitter ¶
func NewTestingEmitter(mockResourceClient MockResourceClient) TestingEmitter
func NewTestingEmitterWithEmit ¶
func NewTestingEmitterWithEmit(mockResourceClient MockResourceClient, emit <-chan struct{}) TestingEmitter
type TestingSimpleEmitter ¶
type TestingSimpleEmitter interface {
Snapshots(ctx context.Context) (<-chan *TestingSnapshot, <-chan error, error)
}
func NewTestingSimpleEmitter ¶
func NewTestingSimpleEmitter(aggregatedWatch clients.ResourceWatch) TestingSimpleEmitter
func NewTestingSimpleEmitterWithEmit ¶
func NewTestingSimpleEmitterWithEmit(aggregatedWatch clients.ResourceWatch, emit <-chan struct{}) TestingSimpleEmitter
type TestingSnapshot ¶
type TestingSnapshot struct {
Mocks MockResourceList
}
func (TestingSnapshot) Clone ¶
func (s TestingSnapshot) Clone() TestingSnapshot
func (TestingSnapshot) HashFields ¶
func (s TestingSnapshot) HashFields() []zap.Field
func (TestingSnapshot) Stringer ¶
func (s TestingSnapshot) Stringer() TestingSnapshotStringer
type TestingSnapshotEmitter ¶ added in v0.10.18
type TestingSnapshotStringer ¶
func (TestingSnapshotStringer) String ¶
func (ss TestingSnapshotStringer) String() string
type TestingSyncDecider
deprecated
type TestingSyncDecider interface { TestingSyncer ShouldSync(old, new *TestingSnapshot) bool }
Deprecated: use TestingSyncDeciderWithContext
type TestingSyncDeciderWithContext ¶
type TestingSyncDeciderWithContext interface { TestingSyncer ShouldSync(ctx context.Context, old, new *TestingSnapshot) bool }
type TestingSyncer ¶
type TestingSyncer interface {
Sync(context.Context, *TestingSnapshot) error
}
type TestingSyncers ¶
type TestingSyncers []TestingSyncer
func (TestingSyncers) Sync ¶
func (s TestingSyncers) Sync(ctx context.Context, snapshot *TestingSnapshot) error
type TransitionFakeResourceFunc ¶
type TransitionFakeResourceFunc func(original, desired *FakeResource) (bool, error)
Option to copy anything from the original to the desired before writing. Return value of false means don't update
type TransitionMockResourceFunc ¶
type TransitionMockResourceFunc func(original, desired *MockResource) (bool, error)
Option to copy anything from the original to the desired before writing. Return value of false means don't update
Source Files ¶
- fake_resource.sk.go
- fake_resource_client.sk.go
- fake_resource_reconciler.sk.go
- mock_resource.sk.go
- mock_resource_client.sk.go
- mock_resource_reconciler.sk.go
- mock_resources.pb.equal.go
- mock_resources.pb.go
- mock_resources.pb.hash.go
- testing_event_loop.sk.go
- testing_simple_event_loop.sk.go
- testing_snapshot.sk.go
- testing_snapshot_emitter.sk.go
- testing_snapshot_simple_emitter.sk.go
Click to show internal directories.
Click to hide internal directories.