router

package
v1.5.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2017 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// HelloPod is the expected response to a call to PodHttpAddr (usually called through a route)
	HelloPod          = "Hello Pod!"
	HelloPodAlternate = "Alternate Hello Pod!"
	// HelloPod is the expected response to a call to PodHttpAddr (usually called through a route)
	HelloPodPath = "Hello Pod Path!"
	// HelloPodSecure is the expected response to a call to PodHttpsAddr (usually called through a route)
	HelloPodSecure = "Hello Pod Secure!"
	// HelloPodPathSecure is the expected response to a call to PodHttpsAddr (usually called through a route)
	HelloPodPathSecure = "Hello Pod Path Secure!"
)

Variables

View Source
var Example2Cert = `` /* 1154-byte string literal not displayed */
View Source
var Example2Key = `` /* 886-byte string literal not displayed */
View Source
var ExampleCACert = `` /* 1479-byte string literal not displayed */
View Source
var ExampleCert = `` /* 1146-byte string literal not displayed */
View Source
var ExampleKey = `` /* 886-byte string literal not displayed */

Functions

func GetDefaultLocalAddress

func GetDefaultLocalAddress() string

GetDefaultLocalAddress returns an address at which the local host can be reached, or 0.0.0.0 (which should work for locations from the host to itself) if the actual default local address cannot be determined.

Types

type TestHttpService

type TestHttpService struct {
	MasterHttpAddr       string
	PodHttpAddr          string
	AlternatePodHttpAddr string
	PodHttpsAddr         string
	PodHttpsCert         []byte
	PodHttpsKey          []byte
	PodHttpsCaCert       []byte
	PodTestPath          string
	EndpointChannel      chan string
	RouteChannel         chan string
	IngressChannel       chan string
	SecretChannel        chan string
	NodeChannel          chan string
	SvcChannel           chan string

	NamespaceListResponse string
	// contains filtered or unexported fields
}

TestHttpService is a service that simulates a master k8s server for the router. It provides endpoints that a router running in docker can attach to for endpoint watches and route watches. It also simulates a client application so that routes can have a destination.

Two channels are provided to simulate watch events: EndpointChannel and RouteChannel. Use these channels in you test cases to feed information to the router that would normally come from client CRUD actions.

List events will return empty data for all calls.

func NewTestHttpService

func NewTestHttpService() *TestHttpService

func NewTestHttpServiceExtended added in v1.5.0

func NewTestHttpServiceExtended(namespaceListResponse string) *TestHttpService

NewTestHttpServer creates a new TestHttpService using default locations for listening address as well as default certificates. New channels will be initialized which can be used by test clients to feed events through the server to anything listening.

func (*TestHttpService) Start

func (s *TestHttpService) Start() error

Start will start the http service to simulate the master and client urls. It sets up the appropriate watch endpoints and serves the secure and non-secure traffic.

func (*TestHttpService) Stop

func (s *TestHttpService) Stop()

Stop stops the service by closing any registered listeners

type TestHttpSocketService

type TestHttpSocketService struct {
	ServeMux         *http.ServeMux
	WebSocketHandler websocket.Handler
}

func (*TestHttpSocketService) ServeHTTP

Jump to

Keyboard shortcuts

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