v2alpha1

package
v0.10.10 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2019 License: Apache-2.0 Imports: 30 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MockResourceCrd = crd.NewCrd(
		"mocks",
		MockResourceGVK.Group,
		MockResourceGVK.Version,
		MockResourceGVK.Kind,
		"mk",
		false,
		&MockResource{})
)
View Source
var (
	MockResourceGVK = schema.GroupVersionKind{
		Version: "v2alpha1",
		Group:   "testing.solo.io",
		Kind:    "MockResource",
	}
)

Functions

func NewTestingEventLoop

func NewTestingEventLoop(emitter TestingEmitter, syncer TestingSyncer) eventloop.EventLoop

func NewTestingSimpleEventLoop

func NewTestingSimpleEventLoop(emitter TestingSimpleEmitter, syncers ...TestingSyncer) eventloop.SimpleEventLoop

Types

type MockResource

type MockResource struct {
	Status   core.Status   `protobuf:"bytes,6,opt,name=status,proto3" json:"status"`
	Metadata core.Metadata `protobuf:"bytes,7,opt,name=metadata,proto3" json:"metadata"`
	// Types that are valid to be assigned to WeStuckItInAOneof:
	//	*MockResource_SomeDumbField
	//	*MockResource_Data
	WeStuckItInAOneof isMockResource_WeStuckItInAOneof `protobuf_oneof:"we_stuck_it_in_a_oneof"`
	// Types that are valid to be assigned to TestOneofFields:
	//	*MockResource_OneofOne
	//	*MockResource_OneofTwo
	TestOneofFields      isMockResource_TestOneofFields `protobuf_oneof:"test_oneof_fields"`
	XXX_NoUnkeyedLiteral struct{}                       `json:"-"`
	XXX_unrecognized     []byte                         `json:"-"`
	XXX_sizecache        int32                          `json:"-"`
}

The best mock resource you ever done seen

func NewMockResource

func NewMockResource(namespace, name string) *MockResource

func (*MockResource) DeepCopyObject

func (o *MockResource) DeepCopyObject() runtime.Object

func (*MockResource) Descriptor

func (*MockResource) Descriptor() ([]byte, []int)

func (*MockResource) Equal

func (this *MockResource) Equal(that interface{}) bool

func (*MockResource) GetData

func (m *MockResource) GetData() string

func (*MockResource) GetMetadata

func (m *MockResource) GetMetadata() core.Metadata

func (*MockResource) GetObjectKind

func (o *MockResource) GetObjectKind() schema.ObjectKind

func (*MockResource) GetOneofOne

func (m *MockResource) GetOneofOne() string

func (*MockResource) GetOneofTwo

func (m *MockResource) GetOneofTwo() bool

func (*MockResource) GetSomeDumbField

func (m *MockResource) GetSomeDumbField() string

func (*MockResource) GetStatus

func (m *MockResource) GetStatus() core.Status

func (*MockResource) GetTestOneofFields

func (m *MockResource) GetTestOneofFields() isMockResource_TestOneofFields

func (*MockResource) GetWeStuckItInAOneof

func (m *MockResource) GetWeStuckItInAOneof() isMockResource_WeStuckItInAOneof

func (*MockResource) GroupVersionKind added in v0.10.4

func (r *MockResource) GroupVersionKind() schema.GroupVersionKind

func (*MockResource) Hash

func (r *MockResource) Hash() uint64

func (*MockResource) ProtoMessage

func (*MockResource) ProtoMessage()

func (*MockResource) Reset

func (m *MockResource) Reset()

func (*MockResource) SetMetadata

func (r *MockResource) SetMetadata(meta core.Metadata)

func (*MockResource) SetStatus

func (r *MockResource) SetStatus(status core.Status)

func (*MockResource) String

func (m *MockResource) String() string

func (*MockResource) XXX_DiscardUnknown

func (m *MockResource) XXX_DiscardUnknown()

func (*MockResource) XXX_Marshal

func (m *MockResource) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MockResource) XXX_Merge

func (m *MockResource) XXX_Merge(src proto.Message)

func (*MockResource) XXX_OneofFuncs

func (*MockResource) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{})

XXX_OneofFuncs is for the internal use of the proto package.

func (*MockResource) XXX_Size

func (m *MockResource) XXX_Size() int

func (*MockResource) XXX_Unmarshal

func (m *MockResource) XXX_Unmarshal(b []byte) error

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(rcFactory factory.ResourceClientFactory) (MockResourceClient, error)

func NewMockResourceClientWithBase

func NewMockResourceClientWithBase(rc clients.ResourceClient) MockResourceClient

func NewMockResourceClientWithToken

func NewMockResourceClientWithToken(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)

namespace is optional, if left empty, names can collide if the list contains more than one with the same name

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) MockResourceReconciler

type MockResourceWatcher

type MockResourceWatcher interface {
	// watch namespace-scoped Mocks
	Watch(namespace string, opts clients.WatchOpts) (<-chan MockResourceList, <-chan error, error)
}

type MockResource_Data

type MockResource_Data struct {
	Data string `protobuf:"bytes,1,opt,name=data,json=data.json,proto3,oneof"`
}

func (*MockResource_Data) Equal

func (this *MockResource_Data) Equal(that interface{}) bool

type MockResource_OneofOne

type MockResource_OneofOne struct {
	OneofOne string `protobuf:"bytes,3,opt,name=oneof_one,json=oneofOne,proto3,oneof"`
}

func (*MockResource_OneofOne) Equal

func (this *MockResource_OneofOne) Equal(that interface{}) bool

type MockResource_OneofTwo

type MockResource_OneofTwo struct {
	OneofTwo bool `protobuf:"varint,2,opt,name=oneof_two,json=oneofTwo,proto3,oneof"`
}

func (*MockResource_OneofTwo) Equal

func (this *MockResource_OneofTwo) Equal(that interface{}) bool

type MockResource_SomeDumbField

type MockResource_SomeDumbField struct {
	SomeDumbField string `protobuf:"bytes,100,opt,name=some_dumb_field,json=someDumbField,proto3,oneof"`
}

func (*MockResource_SomeDumbField) Equal

func (this *MockResource_SomeDumbField) Equal(that interface{}) bool

type TestingEmitter

type TestingEmitter interface {
	Register() error
	MockResource() MockResourceClient
	FakeResource() testing_solo_io.FakeResourceClient
	Snapshots(watchNamespaces []string, opts clients.WatchOpts) (<-chan *TestingSnapshot, <-chan error, error)
}

func NewTestingEmitter

func NewTestingEmitter(mockResourceClient MockResourceClient, fakeResourceClient testing_solo_io.FakeResourceClient) TestingEmitter

func NewTestingEmitterWithEmit

func NewTestingEmitterWithEmit(mockResourceClient MockResourceClient, fakeResourceClient testing_solo_io.FakeResourceClient, 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
	Fakes testing_solo_io.FakeResourceList
}

func (TestingSnapshot) Clone

func (s TestingSnapshot) Clone() TestingSnapshot

func (TestingSnapshot) Hash

func (s TestingSnapshot) Hash() uint64

func (TestingSnapshot) HashFields

func (s TestingSnapshot) HashFields() []zap.Field

func (TestingSnapshot) Stringer

type TestingSnapshotStringer

type TestingSnapshotStringer struct {
	Version uint64
	Mocks   []string
	Fakes   []string
}

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 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

Jump to

Keyboard shortcuts

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