Documentation ¶
Index ¶
Constants ¶
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 ¶
var Example2Cert = `` /* 1154-byte string literal not displayed */
var Example2Key = `` /* 886-byte string literal not displayed */
var ExampleCACert = `` /* 1479-byte string literal not displayed */
var ExampleCert = `` /* 1146-byte string literal not displayed */
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 ¶
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 ¶
func (*TestHttpSocketService) ServeHTTP ¶
func (s *TestHttpSocketService) ServeHTTP(w http.ResponseWriter, r *http.Request)