test_util

package
v0.0.0-...-2fc2a81 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2018 License: Apache-2.0, BSD-2-Clause-Views, BSD-3-Clause, + 1 more Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const LocalhostDNS = "localhost.routing.cf-app.com"

Variables

This section is empty.

Functions

func CreateCert

func CreateCert(cname string) tls.Certificate

func CreateCertDER

func CreateCertDER(cname string) (*rsa.PrivateKey, []byte)

func CreateECCert

func CreateECCert(cname string) tls.Certificate

func CreateECKeyPair

func CreateECKeyPair(cname string) (keyPEM, certPEM []byte)

func CreateKeyPair

func CreateKeyPair(cname string) (keyPEM, certPEM []byte)

func CreateKeyPairFromDER

func CreateKeyPairFromDER(certDER []byte, privKey *rsa.PrivateKey) (keyPEM, certPEM []byte)

func CreateSignedCertDER

func CreateSignedCertDER(cname string, parentCert x509.Certificate, parentKey *rsa.PrivateKey) (*rsa.PrivateKey, []byte)

func NewFakeMetron

func NewFakeMetron() *fakeMetron

func NewRequest

func NewRequest(method, host, rawPath string, body io.Reader) *http.Request

func NewResponse

func NewResponse(status int) *http.Response

func NextAvailPort

func NextAvailPort() uint16

func RegisterAddr

func RegisterAddr(reg *registry.RouteRegistry, path string, addr string, cfg RegisterConfig)

func RegisterHandler

func RegisterHandler(reg *registry.RouteRegistry, path string, handler connHandler, cfg ...RegisterConfig) net.Listener

func SpecConfig

func SpecConfig(statusPort, proxyPort uint16, natsPorts ...uint16) *config.Config

func SpecSSLConfig

func SpecSSLConfig(statusPort, proxyPort, SSLPort uint16, natsPorts ...uint16) (*config.Config, *tls.Config)

Types

type CertChain

type CertChain struct {
	CertPEM, CACertPEM       []byte
	PrivKeyPEM, CAPrivKeyPEM []byte

	CACert    *x509.Certificate
	CAPrivKey *rsa.PrivateKey
}

func CreateSignedCertWithRootCA

func CreateSignedCertWithRootCA(cert CertNames) CertChain

func (*CertChain) AsTLSConfig

func (cc *CertChain) AsTLSConfig() *tls.Config

func (*CertChain) TLSCert

func (c *CertChain) TLSCert() tls.Certificate

func (*CertChain) WriteCACertToDir

func (cc *CertChain) WriteCACertToDir(dir string) string

type CertNames

type CertNames struct {
	CommonName string
	SANs       SubjectAltNames
}

type Event

type Event struct {
	EventType string
	Name      string
	Origin    string
	Value     float64
}

type FakeFile

type FakeFile struct {
	// contains filtered or unexported fields
}

func (*FakeFile) Read

func (f *FakeFile) Read(data *[]byte) (int, error)

func (*FakeFile) Write

func (f *FakeFile) Write(data []byte) (int, error)

type FakeMetron

type FakeMetron interface {
	AllEvents() []Event

	Address() string
	Close() error
	Port() int
}

type HangingReadCloser

type HangingReadCloser struct {
	// contains filtered or unexported fields
}

func (*HangingReadCloser) Close

func (h *HangingReadCloser) Close() error

func (*HangingReadCloser) Read

func (h *HangingReadCloser) Read(p []byte) (n int, err error)

type HttpConn

type HttpConn struct {
	net.Conn

	Reader *bufio.Reader
	Writer *bufio.Writer
}

func NewHttpConn

func NewHttpConn(x net.Conn) *HttpConn

func (*HttpConn) CheckLine

func (x *HttpConn) CheckLine(expected string)

func (*HttpConn) CheckLines

func (x *HttpConn) CheckLines(expected []string)

func (*HttpConn) ReadRequest

func (x *HttpConn) ReadRequest() (*http.Request, string)

func (*HttpConn) ReadResponse

func (x *HttpConn) ReadResponse() (*http.Response, string)

func (*HttpConn) WriteLine

func (x *HttpConn) WriteLine(line string)

func (*HttpConn) WriteLines

func (x *HttpConn) WriteLines(lines []string)

func (*HttpConn) WriteRequest

func (x *HttpConn) WriteRequest(req *http.Request)

func (*HttpConn) WriteResponse

func (x *HttpConn) WriteResponse(resp *http.Response)

type NATSRunner

type NATSRunner struct {
	MessageBus *nats.Conn
	// contains filtered or unexported fields
}

func NewNATSRunner

func NewNATSRunner(port int) *NATSRunner

func (*NATSRunner) KillWithFire

func (runner *NATSRunner) KillWithFire()

func (*NATSRunner) Start

func (runner *NATSRunner) Start()

func (*NATSRunner) Stop

func (runner *NATSRunner) Stop()

type Nats

type Nats struct {
	// contains filtered or unexported fields
}

func NewNats

func NewNats(port uint16) *Nats

func NewNatsOnRandomPort

func NewNatsOnRandomPort() *Nats

func (*Nats) Port

func (n *Nats) Port() uint16

func (*Nats) Start

func (n *Nats) Start()

func (*Nats) Stop

func (n *Nats) Stop()

type RegisterConfig

type RegisterConfig struct {
	RouteServiceUrl     string
	ServerCertDomainSAN string
	InstanceId          string
	InstanceIndex       string
	AppId               string
	StaleThreshold      int
	TLSConfig           *tls.Config
	IgnoreTLSConfig     bool
}

type SubjectAltNames

type SubjectAltNames struct {
	DNS string
	IP  string
}

type TestZapLogger

type TestZapLogger struct {
	logger.Logger
	*TestZapSink
}

TestZapLogger implements a zap logger that can be used with Ginkgo tests

func NewTestZapLogger

func NewTestZapLogger(component string) *TestZapLogger

NewTestZapLogger returns a new test logger using zap

func (*TestZapLogger) Buffer

func (z *TestZapLogger) Buffer() *gbytes.Buffer

Buffer returns the gbytes buffer that was used as the sink

func (*TestZapLogger) Lines

func (z *TestZapLogger) Lines(level zap.Level) []string

type TestZapSink

type TestZapSink struct {
	*gbytes.Buffer
}

Taken from github.com/uber-go/zap

func (*TestZapSink) Lines

func (s *TestZapSink) Lines() []string

func (*TestZapSink) Sync

func (s *TestZapSink) Sync() error

Directories

Path Synopsis
rss

Jump to

Keyboard shortcuts

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