testgateway

package
v0.0.0-...-d9eb102 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2019 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChildProcessGateway

type ChildProcessGateway struct {
	HTTPClient       *http.Client
	JaegerAgent      *testutils.MockAgent
	TChannelClient   zanzibar.TChannelCaller
	M3Service        *testM3Server.FakeM3Service
	MetricsWaitGroup lib.WaitAtLeast
	RealHTTPAddr     string
	RealHTTPHost     string
	RealHTTPPort     int
	RealTChannelAddr string
	RealTChannelHost string
	RealTChannelPort int
	ContextExtractor zanzibar.ContextExtractor
	ContextMetrics   zanzibar.ContextMetrics
	// contains filtered or unexported fields
}

ChildProcessGateway for testing

func (*ChildProcessGateway) AllLogs

func (gateway *ChildProcessGateway) AllLogs() map[string][]LogMessage

AllLogs ...

func (*ChildProcessGateway) Close

func (gateway *ChildProcessGateway) Close()

Close test gateway

func (*ChildProcessGateway) HTTPBackends

func (gateway *ChildProcessGateway) HTTPBackends() map[string]*testBackend.TestHTTPBackend

HTTPBackends returns the HTTP backends

func (*ChildProcessGateway) HTTPPort

func (gateway *ChildProcessGateway) HTTPPort() int

HTTPPort ...

func (*ChildProcessGateway) Logs

func (gateway *ChildProcessGateway) Logs(
	level string,
	msg string,
) []LogMessage

Logs ...

func (*ChildProcessGateway) MakeRequest

func (gateway *ChildProcessGateway) MakeRequest(
	method string,
	url string,
	headers map[string]string,
	body io.Reader,
) (*http.Response, error)

MakeRequest helper

func (*ChildProcessGateway) MakeTChannelRequest

func (gateway *ChildProcessGateway) MakeTChannelRequest(
	ctx context.Context,
	thriftService string,
	method string,
	headers map[string]string,
	req, res zanzibar.RWTStruct,
) (bool, map[string]string, error)

MakeTChannelRequest helper

func (*ChildProcessGateway) TChannelBackends

func (gateway *ChildProcessGateway) TChannelBackends() map[string]*testBackend.TestTChannelBackend

TChannelBackends returns the TChannel backends

type LogMessage

type LogMessage map[string]interface{}

LogMessage is a json log record parsed into map.

type MalformedStdoutError

type MalformedStdoutError struct {
	Type       string
	StdoutLine string
	Message    string
}

MalformedStdoutError is used when the child process has unexpected stdout

func (*MalformedStdoutError) Error

func (err *MalformedStdoutError) Error() string

type Options

type Options struct {
	TestBinary            string
	ConfigFiles           []string
	LogWhitelist          map[string]bool
	KnownHTTPBackends     []string
	KnownTChannelBackends []string
	CountMetrics          bool
	// If MaxMetrics is set we only collect the first N metrics upto
	// the max metrics amount.
	MaxMetrics            int
	EnableRuntimeMetrics  bool
	JaegerDisable         bool
	JaegerFlushMillis     int64
	TChannelClientMethods map[string]string
}

Options used to create TestGateway

type TestGateway

type TestGateway interface {
	MakeRequest(
		method string,
		url string,
		headers map[string]string,
		body io.Reader,
	) (*http.Response, error)
	MakeTChannelRequest(
		ctx context.Context,
		thriftService string,
		method string,
		headers map[string]string,
		req, resp zanzibar.RWTStruct,
	) (bool, map[string]string, error)
	HTTPBackends() map[string]*testBackend.TestHTTPBackend
	TChannelBackends() map[string]*testBackend.TestTChannelBackend
	HTTPPort() int
	Logs(level string, msg string) []LogMessage
	// AllLogs() returns a map of msg to a list of LogMessage
	AllLogs() map[string][]LogMessage

	Close()
}

TestGateway interface

func CreateGateway

func CreateGateway(
	t *testing.T,
	config map[string]interface{},
	opts *Options,
) (TestGateway, error)

CreateGateway bootstrap gateway for testing

Jump to

Keyboard shortcuts

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