mocktest

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Call

func Call(text string, does func(context.Context, Mock)) call

Call declares a function for mocking method calls on a single mock client.

func DescribePaths

func DescribePaths(nodes ...node) []string

DescribePaths computes all permutations for the given nodes and returns a slice of strings describing each permutation.

func NewControllerSuite

func NewControllerSuite(ginkgoT ginkgo.FullGinkgoTInterface, clients ...mock.MockClient) *ctlrSuite

NewControllerSuite creates a test suite for a controller. It generates new mock clients for each test path it runs.

func NewSuite

func NewSuite(t *testing.T, clients ...mock.MockClient) *standardSuite

NewSuite creates a test suite using Go's standard testing library. It generates new mock clients for each test path it runs.

func Once

func Once(text string, does func(context.Context, Mock)) once

Once declares a function that runs one time when executing all test paths. It is triggered at the beginning of the leftmost test path where it is inserted.

func OneOf

func OneOf(nodes ...allOf) oneOf

OneOf declares multiple nodes that fork out into unique test paths.

func Path

func Path(nodes ...node) allOf

Path declares a sequence of nodes belonging to the same test path.

func Result

func Result(text string, does func(context.Context, Mock)) result

Result terminates a test path with a function that tests the effects of mocked method calls.

Types

type Mock

type Mock struct {
	gomock.TestReporter
	mock.MockClients
	// contains filtered or unexported fields
}

Mock holds configuration for a single test path.

func (*Mock) Events

func (m *Mock) Events() string

Events returns a string of all events currently recorded during path evaluation.

func (*Mock) Logger

func (m *Mock) Logger() logr.Logger

Logger returns a logr.Logger for capturing logs written during a reconcile loop. Log output can be read as a single string by calling Logs().

func (*Mock) Logs

func (m *Mock) Logs() string

Logs returns a string of all log outputs currently written during path evaluation.

func (*Mock) Recorder

func (m *Mock) Recorder() *record.FakeRecorder

Recorder returns a *FakeRecorder for recording events published in a reconcile loop. Events can be consumed as a single string by calling Events().

Jump to

Keyboard shortcuts

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