test

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TestService is an example service
	TestService = "grpc.testing.TestService"
	// NotFoundService is a service name that does not exist
	NotFoundService = "not.found.NoService"
	// EmptyCall is a method name
	EmptyCall = "EmptyCall"
	// UnaryCall is a method name
	UnaryCall = "UnaryCall"
	// UnaryCallInputMsgName is the type name of method UnaryCall
	UnaryCallInputMsgName = "grpc.testing.SimpleRequest"
	// NotFoundCall is a method name that does not exist
	NotFoundCall = "NotFoundCall"
	// File is s example protobuf file
	File = "grpc_testing/test.proto"
	// MessageName is another message type name
	MessageName = "grpc.testing.Payload"
)

Variables

View Source
var (
	// TestError ...
	TestError = errors.Errorf("an error")
)

Functions

func NewFileDescriptor

func NewFileDescriptor(t *testing.T, file string) *desc.FileDescriptor

NewFileDescriptor creates a FileDescriptor from the given file for testing

Types

type MockGrpcdynamicStub

type MockGrpcdynamicStub struct {
}

MockGrpcdynamicStub is a mock of grpcdynamicStub

func (*MockGrpcdynamicStub) InvokeRpc

func (m *MockGrpcdynamicStub) InvokeRpc(ctx context.Context, method *desc.MethodDescriptor, request proto.Message, opts ...grpc.CallOption) (proto.Message, error)

InvokeRpc mocks the invocation of an RPC call

type MockGrpcreflectClient

type MockGrpcreflectClient struct {
	*desc.FileDescriptor
}

MockGrpcreflectClient is a mock of grpcreflectClient

func (*MockGrpcreflectClient) ListServices

func (c *MockGrpcreflectClient) ListServices() ([]string, error)

ListServices is a mock that returns all services from test.proto

func (*MockGrpcreflectClient) ResolveService

func (c *MockGrpcreflectClient) ResolveService(serviceName string) (*desc.ServiceDescriptor, error)

ResolveService is a mock that returns TestService from test.proto

Jump to

Keyboard shortcuts

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