fake

package
v0.0.0-...-ffc01b6 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockEvent

type MockEvent struct {
	// EmitFunc mocks the Emit method.
	EmitFunc func(phase apicommon.KeptnPhaseType, eventType string, reconcileObject client.Object, status string, message string, version string)
	// contains filtered or unexported fields
}

MockEvent is a mock implementation of eventsender.IEvent.

func TestSomethingThatUsesIEvent(t *testing.T) {

	// make and configure a mocked eventsender.IEvent
	mockedIEvent := &MockEvent{
		EmitFunc: func(phase apicommon.KeptnPhaseType, eventType string, reconcileObject client.Object, status string, message string, version string)  {
			panic("mock out the Emit method")
		},
	}

	// use mockedIEvent in code that requires eventsender.IEvent
	// and then make assertions.

}

func (*MockEvent) Emit

func (mock *MockEvent) Emit(phase apicommon.KeptnPhaseType, eventType string, reconcileObject client.Object, status string, message string, version string)

Emit calls EmitFunc.

func (*MockEvent) EmitCalls

func (mock *MockEvent) EmitCalls() []struct {
	Phase           apicommon.KeptnPhaseType
	EventType       string
	ReconcileObject client.Object
	Status          string
	Message         string
	Version         string
}

EmitCalls gets all the calls that were made to Emit. Check the length with:

len(mockedIEvent.EmitCalls())

Jump to

Keyboard shortcuts

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