mockhyperbahn

package
v1.21.0 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mock

type Mock struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Mock is up a mock Hyperbahn server for tests.

func New

func New() (*Mock, error)

New returns a mock Hyperbahn server that can be used for testing.

func (*Mock) Channel added in v1.2.1

func (h *Mock) Channel() *tchannel.Channel

Channel returns the underlying tchannel that implements relaying.

func (*Mock) Close

func (h *Mock) Close()

Close stops the mock Hyperbahn server.

func (*Mock) Configuration

func (h *Mock) Configuration() hyperbahn.Configuration

Configuration returns a hyperbahn.Configuration object used to configure a hyperbahn.Client to talk to this mock server.

func (*Mock) Discover

func (h *Mock) Discover(ctx thrift.Context, query *hthrift.DiscoveryQuery) (*hthrift.DiscoveryResult_, error)

Discover returns the IPs for a discovery query if some were set using SetDiscoverResult. Otherwise, it returns an error.

func (*Mock) GetAdvertised

func (h *Mock) GetAdvertised() []string

GetAdvertised returns the list of services registered.

func (*Mock) QueueError

func (h *Mock) QueueError()

QueueError queues an error to be returned on the next advertise call.

func (*Mock) QueueResponse

func (h *Mock) QueueResponse(numConnections int)

QueueResponse queues a response from Hyperbahn. numConnections must be greater than 0.

func (*Mock) SetDiscoverResult

func (h *Mock) SetDiscoverResult(serviceName string, hostPorts []string)

SetDiscoverResult sets the given hostPorts as results for the Discover call.

Jump to

Keyboard shortcuts

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