mocks

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientMock

type ClientMock struct {
	// ChangeSessionFunc mocks the ChangeSession method.
	ChangeSessionFunc func(invocationID string, appSlug string, buildSlug string, stepSlug string)

	// DownloadStreamFunc mocks the DownloadStream method.
	DownloadStreamFunc func(ctx context.Context, writer io.Writer, key string) error

	// GetCapabilitiesWithRetryFunc mocks the GetCapabilitiesWithRetry method.
	GetCapabilitiesWithRetryFunc func(ctx context.Context) error

	// SetLoggerFunc mocks the SetLogger method.
	SetLoggerFunc func(logger log.Logger)

	// UploadStreamToBuildCacheFunc mocks the UploadStreamToBuildCache method.
	UploadStreamToBuildCacheFunc func(ctx context.Context, reader io.Reader, key string, size int64) error
	// contains filtered or unexported fields
}

ClientMock is a mock implementation of proxy.Client.

func TestSomethingThatUsesClient(t *testing.T) {

	// make and configure a mocked proxy.Client
	mockedClient := &ClientMock{
		ChangeSessionFunc: func(invocationID string, appSlug string, buildSlug string, stepSlug string)  {
			panic("mock out the ChangeSession method")
		},
		DownloadStreamFunc: func(ctx context.Context, writer io.Writer, key string) error {
			panic("mock out the DownloadStream method")
		},
		GetCapabilitiesWithRetryFunc: func(ctx context.Context) error {
			panic("mock out the GetCapabilitiesWithRetry method")
		},
		SetLoggerFunc: func(logger log.Logger)  {
			panic("mock out the SetLogger method")
		},
		UploadStreamToBuildCacheFunc: func(ctx context.Context, reader io.Reader, key string, size int64) error {
			panic("mock out the UploadStreamToBuildCache method")
		},
	}

	// use mockedClient in code that requires proxy.Client
	// and then make assertions.

}

func (*ClientMock) ChangeSession

func (mock *ClientMock) ChangeSession(invocationID string, appSlug string, buildSlug string, stepSlug string)

ChangeSession calls ChangeSessionFunc.

func (*ClientMock) ChangeSessionCalls

func (mock *ClientMock) ChangeSessionCalls() []struct {
	InvocationID string
	AppSlug      string
	BuildSlug    string
	StepSlug     string
}

ChangeSessionCalls gets all the calls that were made to ChangeSession. Check the length with:

len(mockedClient.ChangeSessionCalls())

func (*ClientMock) DownloadStream

func (mock *ClientMock) DownloadStream(ctx context.Context, writer io.Writer, key string) error

DownloadStream calls DownloadStreamFunc.

func (*ClientMock) DownloadStreamCalls

func (mock *ClientMock) DownloadStreamCalls() []struct {
	Ctx    context.Context
	Writer io.Writer
	Key    string
}

DownloadStreamCalls gets all the calls that were made to DownloadStream. Check the length with:

len(mockedClient.DownloadStreamCalls())

func (*ClientMock) GetCapabilitiesWithRetry

func (mock *ClientMock) GetCapabilitiesWithRetry(ctx context.Context) error

GetCapabilitiesWithRetry calls GetCapabilitiesWithRetryFunc.

func (*ClientMock) GetCapabilitiesWithRetryCalls

func (mock *ClientMock) GetCapabilitiesWithRetryCalls() []struct {
	Ctx context.Context
}

GetCapabilitiesWithRetryCalls gets all the calls that were made to GetCapabilitiesWithRetry. Check the length with:

len(mockedClient.GetCapabilitiesWithRetryCalls())

func (*ClientMock) SetLogger

func (mock *ClientMock) SetLogger(logger log.Logger)

SetLogger calls SetLoggerFunc.

func (*ClientMock) SetLoggerCalls

func (mock *ClientMock) SetLoggerCalls() []struct {
	Logger log.Logger
}

SetLoggerCalls gets all the calls that were made to SetLogger. Check the length with:

len(mockedClient.SetLoggerCalls())

func (*ClientMock) UploadStreamToBuildCache

func (mock *ClientMock) UploadStreamToBuildCache(ctx context.Context, reader io.Reader, key string, size int64) error

UploadStreamToBuildCache calls UploadStreamToBuildCacheFunc.

func (*ClientMock) UploadStreamToBuildCacheCalls

func (mock *ClientMock) UploadStreamToBuildCacheCalls() []struct {
	Ctx    context.Context
	Reader io.Reader
	Key    string
	Size   int64
}

UploadStreamToBuildCacheCalls gets all the calls that were made to UploadStreamToBuildCache. Check the length with:

len(mockedClient.UploadStreamToBuildCacheCalls())

Jump to

Keyboard shortcuts

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