mock

package
v0.0.0-pre.5 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2025 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 SourceEndpointMock

type SourceEndpointMock struct {
	// ConnectFunc mocks the Connect method.
	ConnectFunc func(ctx context.Context) error

	// DoBasicConnectivityCheckFunc mocks the DoBasicConnectivityCheck method.
	DoBasicConnectivityCheckFunc func() (api.ExternalConnectivityStatus, *x509.Certificate)
	// contains filtered or unexported fields
}

SourceEndpointMock is a mock implementation of migration.SourceEndpoint.

func TestSomethingThatUsesSourceEndpoint(t *testing.T) {

	// make and configure a mocked migration.SourceEndpoint
	mockedSourceEndpoint := &SourceEndpointMock{
		ConnectFunc: func(ctx context.Context) error {
			panic("mock out the Connect method")
		},
		DoBasicConnectivityCheckFunc: func() (api.ExternalConnectivityStatus, *x509.Certificate) {
			panic("mock out the DoBasicConnectivityCheck method")
		},
	}

	// use mockedSourceEndpoint in code that requires migration.SourceEndpoint
	// and then make assertions.

}

func (*SourceEndpointMock) Connect

func (mock *SourceEndpointMock) Connect(ctx context.Context) error

Connect calls ConnectFunc.

func (*SourceEndpointMock) ConnectCalls

func (mock *SourceEndpointMock) ConnectCalls() []struct {
	Ctx context.Context
}

ConnectCalls gets all the calls that were made to Connect. Check the length with:

len(mockedSourceEndpoint.ConnectCalls())

func (*SourceEndpointMock) DoBasicConnectivityCheck

func (mock *SourceEndpointMock) DoBasicConnectivityCheck() (api.ExternalConnectivityStatus, *x509.Certificate)

DoBasicConnectivityCheck calls DoBasicConnectivityCheckFunc.

func (*SourceEndpointMock) DoBasicConnectivityCheckCalls

func (mock *SourceEndpointMock) DoBasicConnectivityCheckCalls() []struct {
}

DoBasicConnectivityCheckCalls gets all the calls that were made to DoBasicConnectivityCheck. Check the length with:

len(mockedSourceEndpoint.DoBasicConnectivityCheckCalls())

type TargetEndpointMock

type TargetEndpointMock struct {
	// ConnectFunc mocks the Connect method.
	ConnectFunc func(ctx context.Context) error

	// DoBasicConnectivityCheckFunc mocks the DoBasicConnectivityCheck method.
	DoBasicConnectivityCheckFunc func() (api.ExternalConnectivityStatus, *x509.Certificate)

	// IsWaitingForOIDCTokensFunc mocks the IsWaitingForOIDCTokens method.
	IsWaitingForOIDCTokensFunc func() bool
	// contains filtered or unexported fields
}

TargetEndpointMock is a mock implementation of migration.TargetEndpoint.

func TestSomethingThatUsesTargetEndpoint(t *testing.T) {

	// make and configure a mocked migration.TargetEndpoint
	mockedTargetEndpoint := &TargetEndpointMock{
		ConnectFunc: func(ctx context.Context) error {
			panic("mock out the Connect method")
		},
		DoBasicConnectivityCheckFunc: func() (api.ExternalConnectivityStatus, *x509.Certificate) {
			panic("mock out the DoBasicConnectivityCheck method")
		},
		IsWaitingForOIDCTokensFunc: func() bool {
			panic("mock out the IsWaitingForOIDCTokens method")
		},
	}

	// use mockedTargetEndpoint in code that requires migration.TargetEndpoint
	// and then make assertions.

}

func (*TargetEndpointMock) Connect

func (mock *TargetEndpointMock) Connect(ctx context.Context) error

Connect calls ConnectFunc.

func (*TargetEndpointMock) ConnectCalls

func (mock *TargetEndpointMock) ConnectCalls() []struct {
	Ctx context.Context
}

ConnectCalls gets all the calls that were made to Connect. Check the length with:

len(mockedTargetEndpoint.ConnectCalls())

func (*TargetEndpointMock) DoBasicConnectivityCheck

func (mock *TargetEndpointMock) DoBasicConnectivityCheck() (api.ExternalConnectivityStatus, *x509.Certificate)

DoBasicConnectivityCheck calls DoBasicConnectivityCheckFunc.

func (*TargetEndpointMock) DoBasicConnectivityCheckCalls

func (mock *TargetEndpointMock) DoBasicConnectivityCheckCalls() []struct {
}

DoBasicConnectivityCheckCalls gets all the calls that were made to DoBasicConnectivityCheck. Check the length with:

len(mockedTargetEndpoint.DoBasicConnectivityCheckCalls())

func (*TargetEndpointMock) IsWaitingForOIDCTokens

func (mock *TargetEndpointMock) IsWaitingForOIDCTokens() bool

IsWaitingForOIDCTokens calls IsWaitingForOIDCTokensFunc.

func (*TargetEndpointMock) IsWaitingForOIDCTokensCalls

func (mock *TargetEndpointMock) IsWaitingForOIDCTokensCalls() []struct {
}

IsWaitingForOIDCTokensCalls gets all the calls that were made to IsWaitingForOIDCTokens. Check the length with:

len(mockedTargetEndpoint.IsWaitingForOIDCTokensCalls())

Jump to

Keyboard shortcuts

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