yarpctest

package
v1.25.1 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2017 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Actions

func Actions(actions ...api.Action) api.Action

Actions will wrap a list of actions in a sequential executor.

func Body

func Body(msg string) api.RequestOption

Body sets the body on a request to the raw representation of the msg field.

func EchoHandler

func EchoHandler(mw ...api.UnaryInboundMiddleware) *types.UnaryHandler

EchoHandler is a Unary Handler that will echo the body of the request into the response.

func EchoHandlerWithPrefix

func EchoHandlerWithPrefix(prefix string, mw ...api.UnaryInboundMiddleware) *types.UnaryHandler

EchoHandlerWithPrefix will echo the request it receives into the response, but, it will insert a prefix in front of the message.

func ErrorHandler

func ErrorHandler(err error, mw ...api.UnaryInboundMiddleware) *types.UnaryHandler

ErrorHandler will always return an Error.

func GRPCRequest

func GRPCRequest(options ...api.RequestOption) api.Action

GRPCRequest creates a new grpc unary request.

func GRPCService

func GRPCService(options ...api.ServiceOption) api.Lifecycle

GRPCService will create a runnable GRPC service.

func GiveAndWantLargeBodyIsEchoed

func GiveAndWantLargeBodyIsEchoed(numOfBytes int) api.RequestOption

GiveAndWantLargeBodyIsEchoed creates an extremely large random byte buffer and validates that the body is echoed back to the response.

func HTTPRequest

func HTTPRequest(options ...api.RequestOption) api.Action

HTTPRequest creates a new YARPC http request.

func HTTPService

func HTTPService(options ...api.ServiceOption) api.Lifecycle

HTTPService will create a runnable HTTP service.

func Lifecycles

func Lifecycles(l ...api.Lifecycle) api.Lifecycle

Lifecycles is a wrapper around a list of Lifecycle definitions.

func Name

func Name(name string) *types.Name

Name is a shared option across services and procedures. It can be used as input in the constructor of both types.

func NewPortProvider

func NewPortProvider(t testing.TB) *types.PortProvider

NewPortProvider creates an object that can be used to synchronize ports in yarpctest infrastructure. Ports can be acquired through the "Port" function which will create new ports for the test based on the id passed into the function.

func OrderedRequestHandler

func OrderedRequestHandler(options ...api.HandlerOption) *types.OrderedHandler

OrderedRequestHandler will execute a series of Handlers in the order they are passed in. If the number of requests does not match, it will return an unknown error.

func Port

func Port(port uint16) *types.Port

Port is a shared option across services and requests. It can be embedded in the constructor of both types.

func Proc

func Proc(options ...api.ProcOption) api.ServiceOption

Proc will create a new Procedure that can be included in a Service.

func Procedure

func Procedure(procedure string) *types.Procedure

Procedure specifies the "procedure" header for a request. It is a shared option across different requests.

func Service

func Service(service string) *types.Service

Service specifies the "service" header for a request. It is a shared option across different requests.

func ShardKey

func ShardKey(key string) *types.ShardKey

ShardKey specifies that "shard key" header for a request. It is a shared option across different requests.

func StaticHandler

func StaticHandler(msg string, mw ...api.UnaryInboundMiddleware) *types.UnaryHandler

StaticHandler will always return the same response.

func TChannelRequest

func TChannelRequest(options ...api.RequestOption) api.Action

TChannelRequest creates a new tchannel request.

func TChannelService

func TChannelService(options ...api.ServiceOption) api.Lifecycle

TChannelService will create a runnable TChannel service.

func WantError

func WantError(errMsg string) api.RequestOption

WantError creates an assertion on the request response to validate the error.

func WantHeader

func WantHeader(key, value string) *types.WantHeader

WantHeader will set up a header assertion for request/response headers.

func WantRespBody

func WantRespBody(body string) api.RequestOption

WantRespBody will assert that the response body matches at the end of the request.

func WithHeader

func WithHeader(key, value string) *types.GiveHeader

WithHeader will send headers for requests and responses.

Types

type Action

type Action api.Action

Action is the interface for applying actions (Requests) in tests.

type Lifecycle

type Lifecycle api.Lifecycle

Lifecycle is the interface for creating/starting/stopping lifecycles (Services) in tests.

Directories

Path Synopsis
Package api is for all interfaces and patterns that need to be implemented to interact with the yarpctest api, but not the explicit types we'll use to make requests, or the types that we'll use directly in tests.
Package api is for all interfaces and patterns that need to be implemented to interact with the yarpctest api, but not the explicit types we'll use to make requests, or the types that we'll use directly in tests.
Package types are for objects in the yarpctest API that implement multiple interfaces.
Package types are for objects in the yarpctest API that implement multiple interfaces.

Jump to

Keyboard shortcuts

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