Documentation
¶
Index ¶
- func NewClient(objs ...client.Object) client.Client
- func SetupSchemes()
- type ISpanHandlerMock
- func (mock *ISpanHandlerMock) GetSpan(ctx context.Context, tracer trace.Tracer, reconcileObject client.Object, ...) (context.Context, trace.Span, error)
- func (mock *ISpanHandlerMock) GetSpanCalls() []struct{ ... }
- func (mock *ISpanHandlerMock) UnbindSpan(reconcileObject client.Object, phase string) error
- func (mock *ISpanHandlerMock) UnbindSpanCalls() []struct{ ... }
- type ITracerMock
- type TracerFactoryMock
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewClient ¶
NewClient returns a new controller-runtime fake Client configured with the Operator's scheme, and initialized with objs.
func SetupSchemes ¶
func SetupSchemes()
Types ¶
type ISpanHandlerMock ¶
type ISpanHandlerMock struct {
// GetSpanFunc mocks the GetSpan method.
GetSpanFunc func(ctx context.Context, tracer trace.Tracer, reconcileObject client.Object, phase string) (context.Context, trace.Span, error)
// UnbindSpanFunc mocks the UnbindSpan method.
UnbindSpanFunc func(reconcileObject client.Object, phase string) error
// contains filtered or unexported fields
}
ISpanHandlerMock is a mock implementation of common.ISpanHandler.
func TestSomethingThatUsesISpanHandler(t *testing.T) {
// make and configure a mocked common.ISpanHandler
mockedISpanHandler := &ISpanHandlerMock{
GetSpanFunc: func(ctx context.Context, tracer trace.Tracer, reconcileObject client.Object, phase string) (context.Context, trace.Span, error) {
panic("mock out the GetSpan method")
},
UnbindSpanFunc: func(reconcileObject client.Object, phase string) error {
panic("mock out the UnbindSpan method")
},
}
// use mockedISpanHandler in code that requires common.ISpanHandler
// and then make assertions.
}
func (*ISpanHandlerMock) GetSpan ¶
func (mock *ISpanHandlerMock) GetSpan(ctx context.Context, tracer trace.Tracer, reconcileObject client.Object, phase string) (context.Context, trace.Span, error)
GetSpan calls GetSpanFunc.
func (*ISpanHandlerMock) GetSpanCalls ¶
func (mock *ISpanHandlerMock) GetSpanCalls() []struct { Ctx context.Context Tracer trace.Tracer ReconcileObject client.Object Phase string }
GetSpanCalls gets all the calls that were made to GetSpan. Check the length with:
len(mockedISpanHandler.GetSpanCalls())
func (*ISpanHandlerMock) UnbindSpan ¶
func (mock *ISpanHandlerMock) UnbindSpan(reconcileObject client.Object, phase string) error
UnbindSpan calls UnbindSpanFunc.
func (*ISpanHandlerMock) UnbindSpanCalls ¶
func (mock *ISpanHandlerMock) UnbindSpanCalls() []struct { ReconcileObject client.Object Phase string }
UnbindSpanCalls gets all the calls that were made to UnbindSpan. Check the length with:
len(mockedISpanHandler.UnbindSpanCalls())
type ITracerMock ¶
type ITracerMock struct {
// StartFunc mocks the Start method.
StartFunc func(ctx context.Context, spanName string, opts ...trace.SpanStartOption) (context.Context, trace.Span)
// contains filtered or unexported fields
}
ITracerMock is a mock implementation of interfaces.ITracer.
func TestSomethingThatUsesITracer(t *testing.T) {
// make and configure a mocked interfaces.ITracer
mockedITracer := &ITracerMock{
StartFunc: func(ctx context.Context, spanName string, opts ...trace.SpanStartOption) (context.Context, trace.Span) {
panic("mock out the Start method")
},
}
// use mockedITracer in code that requires interfaces.ITracer
// and then make assertions.
}
func (*ITracerMock) Start ¶
func (mock *ITracerMock) Start(ctx context.Context, spanName string, opts ...trace.SpanStartOption) (context.Context, trace.Span)
Start calls StartFunc.
func (*ITracerMock) StartCalls ¶
func (mock *ITracerMock) StartCalls() []struct { Ctx context.Context SpanName string Opts []trace.SpanStartOption }
StartCalls gets all the calls that were made to Start. Check the length with:
len(mockedITracer.StartCalls())
type TracerFactoryMock ¶
type TracerFactoryMock struct {
// GetTracerFunc mocks the GetTracer method.
GetTracerFunc func(name string) trace.Tracer
// contains filtered or unexported fields
}
TracerFactoryMock is a mock implementation of interfaces.TracerFactory.
func TestSomethingThatUsesTracerFactory(t *testing.T) {
// make and configure a mocked interfaces.TracerFactory
mockedTracerFactory := &TracerFactoryMock{
GetTracerFunc: func(name string) trace.Tracer {
panic("mock out the GetTracer method")
},
}
// use mockedTracerFactory in code that requires interfaces.TracerFactory
// and then make assertions.
}
func (*TracerFactoryMock) GetTracer ¶
func (mock *TracerFactoryMock) GetTracer(name string) trace.Tracer
GetTracer calls GetTracerFunc.
func (*TracerFactoryMock) GetTracerCalls ¶
func (mock *TracerFactoryMock) GetTracerCalls() []struct { Name string }
GetTracerCalls gets all the calls that were made to GetTracer. Check the length with:
len(mockedTracerFactory.GetTracerCalls())