fake

package
v0.0.0-...-67b0140 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ISpanHandlerMock

type ISpanHandlerMock struct {
	// GetSpanFunc mocks the GetSpan method.
	GetSpanFunc func(ctx context.Context, tracer telemetry.ITracer, reconcileObject client.Object, phase string, links ...trace.Link) (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 telemetry.ISpanHandler.

func TestSomethingThatUsesISpanHandler(t *testing.T) {

	// make and configure a mocked telemetry.ISpanHandler
	mockedISpanHandler := &ISpanHandlerMock{
		GetSpanFunc: func(ctx context.Context, tracer telemetry.ITracer, reconcileObject client.Object, phase string, links ...trace.Link) (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 telemetry.ISpanHandler
	// and then make assertions.

}

func (*ISpanHandlerMock) GetSpan

func (mock *ISpanHandlerMock) GetSpan(ctx context.Context, tracer telemetry.ITracer, reconcileObject client.Object, phase string, links ...trace.Link) (context.Context, trace.Span, error)

GetSpan calls GetSpanFunc.

func (*ISpanHandlerMock) GetSpanCalls

func (mock *ISpanHandlerMock) GetSpanCalls() []struct {
	Ctx             context.Context
	Tracer          telemetry.ITracer
	ReconcileObject client.Object
	Phase           string
	Links           []trace.Link
}

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 telemetry.ITracer.

func TestSomethingThatUsesITracer(t *testing.T) {

	// make and configure a mocked telemetry.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 telemetry.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) telemetry.ITracer
	// contains filtered or unexported fields
}

TracerFactoryMock is a mock implementation of telemetry.TracerFactory.

func TestSomethingThatUsesTracerFactory(t *testing.T) {

	// make and configure a mocked telemetry.TracerFactory
	mockedTracerFactory := &TracerFactoryMock{
		GetTracerFunc: func(name string) telemetry.ITracer {
			panic("mock out the GetTracer method")
		},
	}

	// use mockedTracerFactory in code that requires telemetry.TracerFactory
	// and then make assertions.

}

func (*TracerFactoryMock) GetTracer

func (mock *TracerFactoryMock) GetTracer(name string) telemetry.ITracer

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

Jump to

Keyboard shortcuts

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