testbackend

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildHTTPBackends

func BuildHTTPBackends(
	cfg map[string]interface{}, knownHTTPBackends []string,
) (map[string]*TestHTTPBackend, error)

BuildHTTPBackends returns a map of backends based on config

func BuildTChannelBackends

func BuildTChannelBackends(
	cfg map[string]interface{}, knownTChannelBackends []string,
) (map[string]*TestTChannelBackend, error)

BuildTChannelBackends returns a map of TChannel backends based on config

Types

type TestHTTPBackend

type TestHTTPBackend struct {
	Server    *zanzibar.HTTPServer
	IP        string
	Port      int32
	RealPort  int32
	RealAddr  string
	WaitGroup *sync.WaitGroup
	// contains filtered or unexported fields
}

TestHTTPBackend will pretend to be a http backend

func CreateHTTPBackend

func CreateHTTPBackend(port int32) *TestHTTPBackend

CreateHTTPBackend creates a HTTP backend for testing

func (*TestHTTPBackend) Bootstrap

func (backend *TestHTTPBackend) Bootstrap() error

Bootstrap creates a backend for testing

func (*TestHTTPBackend) Close

func (backend *TestHTTPBackend) Close()

Close ...

func (*TestHTTPBackend) HandleFunc

func (backend *TestHTTPBackend) HandleFunc(
	method string, path string, handler http.HandlerFunc,
)

HandleFunc registers funcs

func (*TestHTTPBackend) Wait

func (backend *TestHTTPBackend) Wait()

Wait ...

type TestTChannelBackend

type TestTChannelBackend struct {
	Channel  *tchannel.Channel
	Router   *zanzibar.TChannelRouter
	IP       string
	Port     int32
	RealPort int32
	RealAddr string
}

TestTChannelBackend will pretend to be a http backend

func CreateTChannelBackend

func CreateTChannelBackend(port int32, serviceName string) (*TestTChannelBackend, error)

CreateTChannelBackend creates a TChannel backend for testing "serviceName" is the service discovery name, not necessarily same as the thrift service name.

func (*TestTChannelBackend) Bootstrap

func (backend *TestTChannelBackend) Bootstrap() error

Bootstrap creates a backend for testing

func (*TestTChannelBackend) Close

func (backend *TestTChannelBackend) Close()

Close closes the underlying channel

func (*TestTChannelBackend) Register

func (backend *TestTChannelBackend) Register(
	endpointID, handlerID, method string,
	handler zanzibar.TChannelHandler,
) error

Register registers tchannel server handler

Jump to

Keyboard shortcuts

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