mock

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LookupRPC  = "trisa.gds.api.v1beta1.TRISADirectory/Lookup"
	SearchRPC  = "trisa.gds.api.v1beta1.TRISADirectory/Search"
	SummaryRPC = "gds.members.v1alpha1.TRISAMembers/Summary"
	ListRPC    = "gds.members.v1alpha1.TRISAMembers/List"
	DetailRPC  = "gds.members.v1alpha1.TRISAMembers/Details"
	StatusRPC  = "trisa.gds.api.v1beta1.TRISADirectory/Status"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GDS

GDS implements a mock gRPC server for testing TRISA Global Directory Service client connections. The desired response of the directory service can be set by external callers using the OnRPC functions or the WithFixture or WithError functions. The Calls map can be used to count the number of times the remote peer PRC was called.

func New

func New(bufnet *bufconn.Listener) *GDS

New creates a new mock GDS. If bufnet is nil, one is created for the user.

func (*GDS) Channel

func (s *GDS) Channel() *bufconn.Listener

func (*GDS) Details

func (*GDS) List

func (s *GDS) List(ctx context.Context, in *members.ListRequest) (*members.ListReply, error)

func (*GDS) Lookup

func (s *GDS) Lookup(ctx context.Context, in *gds.LookupRequest) (*gds.LookupReply, error)

func (*GDS) Reset

func (s *GDS) Reset()

func (*GDS) Search

func (s *GDS) Search(ctx context.Context, in *gds.SearchRequest) (*gds.SearchReply, error)

func (*GDS) Shutdown

func (s *GDS) Shutdown()

func (*GDS) Status

func (s *GDS) Status(ctx context.Context, in *gds.HealthCheck) (*gds.ServiceState, error)

func (*GDS) Summary

func (*GDS) UseError

func (s *GDS) UseError(rpc string, code codes.Code, msg string) error

UseError allows you to specify a gRPC status error to return from the specified RPC.

func (*GDS) UseFixture

func (s *GDS) UseFixture(rpc, path string) (err error)

UseFixture loadsa a JSON fixture from disk (usually in a testdata folder) to use as the protocol buffer response to the specified RPC, simplifying handler mocking.

Jump to

Keyboard shortcuts

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