agentharness

package
v0.28.0 Latest Latest
Warning

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

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

Documentation

Overview

Package mockagent is a generated GoMock package.

Package agentharness is a testing framework to mock any RPC agent based on it's DDL

All actions declared in the DDL will be mocked using gomock, expectations can be set using the Stub() method

See the harness test integration suite for an example

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionMiddleware

type ActionMiddleware interface {
	Action(ctx context.Context, req *mcorpc.Request, rep *mcorpc.Reply, agent *mcorpc.Agent, conn inter.ConnectorInfo)
}

type AgentHarness

type AgentHarness struct {
	// contains filtered or unexported fields
}

func New

func New(fw inter.Framework, ctl *gomock.Controller, name string, ddl *addl.DDL) (*AgentHarness, error)

New creates a new test harness with all the actions found in ddl mocked using gomock

func NewWithDDLBytes

func NewWithDDLBytes(fw inter.Framework, ctl *gomock.Controller, name string, ddlBytes []byte) (*AgentHarness, error)

NewWithDDLBytes creates a new test harness based on a ddl contained in ddlBytes

func NewWithDDLFile

func NewWithDDLFile(fw inter.Framework, ctl *gomock.Controller, name string, ddlFile string) (*AgentHarness, error)

NewWithDDLFile creates a new test harness based on a ddl contained on disk

func (*AgentHarness) Agent

func (h *AgentHarness) Agent() (*mcorpc.Agent, error)

Agent creates a valid mcorpc agent ready for passing to a server instance AgentManager

func (*AgentHarness) Stub

func (h *AgentHarness) Stub(actionName string, action mcorpc.Action) *gomock.Call

Stub sets an implementation action to be called for a specific action, panics for unknown action

type MockActionMiddleware

type MockActionMiddleware struct {
	// contains filtered or unexported fields
}

MockActionMiddleware is a mock of ActionMiddleware interface.

func NewMockActionMiddleware

func NewMockActionMiddleware(ctrl *gomock.Controller) *MockActionMiddleware

NewMockActionMiddleware creates a new mock instance.

func (*MockActionMiddleware) Action

func (m *MockActionMiddleware) Action(ctx context.Context, req *mcorpc.Request, rep *mcorpc.Reply, agent *mcorpc.Agent, conn inter.ConnectorInfo)

Action mocks base method.

func (*MockActionMiddleware) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

type MockActionMiddlewareMockRecorder

type MockActionMiddlewareMockRecorder struct {
	// contains filtered or unexported fields
}

MockActionMiddlewareMockRecorder is the mock recorder for MockActionMiddleware.

func (*MockActionMiddlewareMockRecorder) Action

func (mr *MockActionMiddlewareMockRecorder) Action(ctx, req, rep, agent, conn any) *gomock.Call

Action indicates an expected call of Action.

Jump to

Keyboard shortcuts

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