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: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockHandler

type MockHandler struct {
	// HandlePhaseFunc mocks the HandlePhase method.
	HandlePhaseFunc func(ctx context.Context, ctxTrace context.Context, tracer telemetry.ITracer, reconcileObject client.Object, phaseMoqParam apicommon.KeptnPhaseType, reconcilePhase func(phaseCtx context.Context) (apicommon.KeptnState, error)) (phase.PhaseResult, error)
	// contains filtered or unexported fields
}

MockHandler is a mock implementation of phase.IHandler.

func TestSomethingThatUsesIHandler(t *testing.T) {

	// make and configure a mocked phase.IHandler
	mockedIHandler := &MockHandler{
		HandlePhaseFunc: func(ctx context.Context, ctxTrace context.Context, tracer telemetry.ITracer, reconcileObject client.Object, phaseMoqParam apicommon.KeptnPhaseType, reconcilePhase func(phaseCtx context.Context) (apicommon.KeptnState, error)) (phase.PhaseResult, error) {
			panic("mock out the HandlePhase method")
		},
	}

	// use mockedIHandler in code that requires phase.IHandler
	// and then make assertions.

}

func (*MockHandler) HandlePhase

func (mock *MockHandler) HandlePhase(ctx context.Context, ctxTrace context.Context, tracer telemetry.ITracer, reconcileObject client.Object, phaseMoqParam apicommon.KeptnPhaseType, reconcilePhase func(phaseCtx context.Context) (apicommon.KeptnState, error)) (phase.PhaseResult, error)

HandlePhase calls HandlePhaseFunc.

func (*MockHandler) HandlePhaseCalls

func (mock *MockHandler) HandlePhaseCalls() []struct {
	Ctx             context.Context
	CtxTrace        context.Context
	Tracer          telemetry.ITracer
	ReconcileObject client.Object
	PhaseMoqParam   apicommon.KeptnPhaseType
	ReconcilePhase  func(phaseCtx context.Context) (apicommon.KeptnState, error)
}

HandlePhaseCalls gets all the calls that were made to HandlePhase. Check the length with:

len(mockedIHandler.HandlePhaseCalls())

Jump to

Keyboard shortcuts

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