mocks

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CapabilitiesClientMock

type CapabilitiesClientMock struct {
	// GetCapabilitiesFunc mocks the GetCapabilities method.
	GetCapabilitiesFunc func(ctx context.Context, in *remoteexecution.GetCapabilitiesRequest, opts ...grpc.CallOption) (*remoteexecution.ServerCapabilities, error)
	// contains filtered or unexported fields
}

CapabilitiesClientMock is a mock implementation of remoteexecution.CapabilitiesClient.

func TestSomethingThatUsesCapabilitiesClient(t *testing.T) {

	// make and configure a mocked remoteexecution.CapabilitiesClient
	mockedCapabilitiesClient := &CapabilitiesClientMock{
		GetCapabilitiesFunc: func(ctx context.Context, in *remoteexecution.GetCapabilitiesRequest, opts ...grpc.CallOption) (*remoteexecution.ServerCapabilities, error) {
			panic("mock out the GetCapabilities method")
		},
	}

	// use mockedCapabilitiesClient in code that requires remoteexecution.CapabilitiesClient
	// and then make assertions.

}

func (*CapabilitiesClientMock) GetCapabilities

func (mock *CapabilitiesClientMock) GetCapabilities(ctx context.Context, in *remoteexecution.GetCapabilitiesRequest, opts ...grpc.CallOption) (*remoteexecution.ServerCapabilities, error)

GetCapabilities calls GetCapabilitiesFunc.

func (*CapabilitiesClientMock) GetCapabilitiesCalls

func (mock *CapabilitiesClientMock) GetCapabilitiesCalls() []struct {
	Ctx  context.Context
	In   *remoteexecution.GetCapabilitiesRequest
	Opts []grpc.CallOption
}

GetCapabilitiesCalls gets all the calls that were made to GetCapabilities. Check the length with:

len(mockedCapabilitiesClient.GetCapabilitiesCalls())

type KVStorageClientMock

type KVStorageClientMock struct {
	// DeleteFunc mocks the Delete method.
	DeleteFunc func(ctx context.Context, in *bytestream.ReadRequest, opts ...grpc.CallOption) (*kv_storage.DeleteResponse, error)

	// GetFunc mocks the Get method.
	GetFunc func(ctx context.Context, in *bytestream.ReadRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[bytestream.ReadResponse], error)

	// PutFunc mocks the Put method.
	PutFunc func(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[bytestream.WriteRequest, bytestream.WriteResponse], error)
	// contains filtered or unexported fields
}

KVStorageClientMock is a mock implementation of kv_storage.KVStorageClient.

func TestSomethingThatUsesKVStorageClient(t *testing.T) {

	// make and configure a mocked kv_storage.KVStorageClient
	mockedKVStorageClient := &KVStorageClientMock{
		DeleteFunc: func(ctx context.Context, in *bytestream.ReadRequest, opts ...grpc.CallOption) (*kv_storage.DeleteResponse, error) {
			panic("mock out the Delete method")
		},
		GetFunc: func(ctx context.Context, in *bytestream.ReadRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[bytestream.ReadResponse], error) {
			panic("mock out the Get method")
		},
		PutFunc: func(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[bytestream.WriteRequest, bytestream.WriteResponse], error) {
			panic("mock out the Put method")
		},
	}

	// use mockedKVStorageClient in code that requires kv_storage.KVStorageClient
	// and then make assertions.

}

func (*KVStorageClientMock) Delete

Delete calls DeleteFunc.

func (*KVStorageClientMock) DeleteCalls

func (mock *KVStorageClientMock) DeleteCalls() []struct {
	Ctx  context.Context
	In   *bytestream.ReadRequest
	Opts []grpc.CallOption
}

DeleteCalls gets all the calls that were made to Delete. Check the length with:

len(mockedKVStorageClient.DeleteCalls())

func (*KVStorageClientMock) Get

Get calls GetFunc.

func (*KVStorageClientMock) GetCalls

func (mock *KVStorageClientMock) GetCalls() []struct {
	Ctx  context.Context
	In   *bytestream.ReadRequest
	Opts []grpc.CallOption
}

GetCalls gets all the calls that were made to Get. Check the length with:

len(mockedKVStorageClient.GetCalls())

func (*KVStorageClientMock) Put

Put calls PutFunc.

func (*KVStorageClientMock) PutCalls

func (mock *KVStorageClientMock) PutCalls() []struct {
	Ctx  context.Context
	Opts []grpc.CallOption
}

PutCalls gets all the calls that were made to Put. Check the length with:

len(mockedKVStorageClient.PutCalls())

type SessionClientMock

type SessionClientMock struct {
	// GetSessionStatsFunc mocks the GetSessionStats method.
	GetSessionStatsFunc func(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*session.GetSessionStatsResponse, error)

	// SetSessionFunc mocks the SetSession method.
	SetSessionFunc func(ctx context.Context, in *session.SetSessionRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// contains filtered or unexported fields
}

SessionClientMock is a mock implementation of session.SessionClient.

func TestSomethingThatUsesSessionClient(t *testing.T) {

	// make and configure a mocked session.SessionClient
	mockedSessionClient := &SessionClientMock{
		GetSessionStatsFunc: func(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*session.GetSessionStatsResponse, error) {
			panic("mock out the GetSessionStats method")
		},
		SetSessionFunc: func(ctx context.Context, in *session.SetSessionRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
			panic("mock out the SetSession method")
		},
	}

	// use mockedSessionClient in code that requires session.SessionClient
	// and then make assertions.

}

func (*SessionClientMock) GetSessionStats

func (mock *SessionClientMock) GetSessionStats(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*session.GetSessionStatsResponse, error)

GetSessionStats calls GetSessionStatsFunc.

func (*SessionClientMock) GetSessionStatsCalls

func (mock *SessionClientMock) GetSessionStatsCalls() []struct {
	Ctx  context.Context
	In   *emptypb.Empty
	Opts []grpc.CallOption
}

GetSessionStatsCalls gets all the calls that were made to GetSessionStats. Check the length with:

len(mockedSessionClient.GetSessionStatsCalls())

func (*SessionClientMock) SetSession

func (mock *SessionClientMock) SetSession(ctx context.Context, in *session.SetSessionRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)

SetSession calls SetSessionFunc.

func (*SessionClientMock) SetSessionCalls

func (mock *SessionClientMock) SetSessionCalls() []struct {
	Ctx  context.Context
	In   *session.SetSessionRequest
	Opts []grpc.CallOption
}

SetSessionCalls gets all the calls that were made to SetSession. Check the length with:

len(mockedSessionClient.SetSessionCalls())

type XcelerateConfigMock

type XcelerateConfigMock struct {
	// SaveFunc mocks the Save method.
	SaveFunc func(logger log.Logger, os utils.OsProxy, encoderFactory utils.EncoderFactory) error
	// contains filtered or unexported fields
}

XcelerateConfigMock is a mock implementation of xcode.XcelerateConfig.

func TestSomethingThatUsesXcelerateConfig(t *testing.T) {

	// make and configure a mocked xcode.XcelerateConfig
	mockedXcelerateConfig := &XcelerateConfigMock{
		SaveFunc: func(logger log.Logger, os utils.OsProxy, encoderFactory utils.EncoderFactory) error {
			panic("mock out the Save method")
		},
	}

	// use mockedXcelerateConfig in code that requires xcode.XcelerateConfig
	// and then make assertions.

}

func (*XcelerateConfigMock) Save

func (mock *XcelerateConfigMock) Save(logger log.Logger, os utils.OsProxy, encoderFactory utils.EncoderFactory) error

Save calls SaveFunc.

func (*XcelerateConfigMock) SaveCalls

func (mock *XcelerateConfigMock) SaveCalls() []struct {
	Logger         log.Logger
	Os             utils.OsProxy
	EncoderFactory utils.EncoderFactory
}

SaveCalls gets all the calls that were made to Save. Check the length with:

len(mockedXcelerateConfig.SaveCalls())

type XcodeRunnerMock

type XcodeRunnerMock struct {
	// RunFunc mocks the Run method.
	RunFunc func(ctx context.Context, args []string) xcodeargs.RunStats
	// contains filtered or unexported fields
}

XcodeRunnerMock is a mock implementation of xcode.XcodeRunner.

func TestSomethingThatUsesXcodeRunner(t *testing.T) {

	// make and configure a mocked xcode.XcodeRunner
	mockedXcodeRunner := &XcodeRunnerMock{
		RunFunc: func(ctx context.Context, args []string) xcodeargs.RunStats {
			panic("mock out the Run method")
		},
	}

	// use mockedXcodeRunner in code that requires xcode.XcodeRunner
	// and then make assertions.

}

func (*XcodeRunnerMock) Run

func (mock *XcodeRunnerMock) Run(ctx context.Context, args []string) xcodeargs.RunStats

Run calls RunFunc.

func (*XcodeRunnerMock) RunCalls

func (mock *XcodeRunnerMock) RunCalls() []struct {
	Ctx  context.Context
	Args []string
}

RunCalls gets all the calls that were made to Run. Check the length with:

len(mockedXcodeRunner.RunCalls())

Jump to

Keyboard shortcuts

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