Documentation ¶
Index ¶
- type Mock
- func (h *Mock) Channel() *tchannel.Channel
- func (h *Mock) Close()
- func (h *Mock) Configuration() hyperbahn.Configuration
- func (h *Mock) Discover(ctx thrift.Context, query *hthrift.DiscoveryQuery) (*hthrift.DiscoveryResult_, error)
- func (h *Mock) GetAdvertised() []string
- func (h *Mock) QueueError()
- func (h *Mock) QueueResponse(numConnections int)
- func (h *Mock) SetDiscoverResult(serviceName string, hostPorts []string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mock ¶
Mock is up a mock Hyperbahn server for tests.
func (*Mock) Channel ¶
func (h *Mock) Channel() *tchannel.Channel
Channel returns the underlying tchannel that implements relaying.
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 ¶
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 ¶
QueueResponse queues a response from Hyperbahn. numConnections must be greater than 0.
func (*Mock) SetDiscoverResult ¶
SetDiscoverResult sets the given hostPorts as results for the Discover call.