Documentation ¶
Index ¶
- Constants
- Variables
- func AssertProberDefault(t pkgTest.T, p Prober)
- func BuildClientConfig(kubeConfigPath string, clusterName string) (*rest.Config, error)
- func CheckSLO(slo float64, name string, p Prober) error
- func CleanupOnInterrupt(cleanup func())
- func ListenAndServeGracefully(addr string, handler func(w http.ResponseWriter, r *http.Request))
- func ListenAndServeGracefullyWithHandler(addr string, handler http.Handler)
- func SubServiceNameForTest(t pkgTest.T, subsvc string) string
- func TearDown(clients *Clients, names ResourceNames)
- type Clients
- type NetworkingClients
- type Prober
- type ProberManager
- type ResourceNames
- type ServingAlphaClients
- type ServingBetaClients
- type ServingClients
- type ServingEnvironmentFlags
Constants ¶
const ( // Test image names Autoscale = "autoscale" Failing = "failing" HelloVolume = "hellovolume" HelloWorld = "helloworld" HTTPProxy = "httpproxy" InvalidHelloWorld = "invalidhelloworld" // Not a real image PizzaPlanet1 = "pizzaplanetv1" PizzaPlanet2 = "pizzaplanetv2" Protocols = "protocols" Runtime = "runtime" SingleThreadedImage = "singlethreaded" Timeout = "timeout" WorkingDir = "workingdir" // Constants for test image output. PizzaPlanetText1 = "What a spaceport!" PizzaPlanetText2 = "Re-energize yourself with a slice of pepperoni!" HelloWorldText = "Hello World! How about some tasty noodles?" ConcurrentRequests = 50 // We expect to see 100% of requests succeed for traffic sent directly to revisions. // This might be a bad assumption. MinDirectPercentage = 1 // We expect to see at least 25% of either response since we're routing 50/50. // This might be a bad assumption. MinSplitPercentage = 0.25 )
Constants for test images located in test/test_images.
const ( // ServingNamespace is the default namespace for serving e2e tests ServingNamespace = "serving-tests" // AlternativeServingNamespace is a different namepace to run cross- // namespace tests in. AlternativeServingNamespace = "serving-tests-alt" // ServingNamespaceforSecurityTesting is the namespace for security tests. ServingNamespaceforSecurityTesting = "serving-tests-security" // ConformanceConfigMap is the name of the configmap to propagate env variables from ConformanceConfigMap = "conformance-test-configmap" // ConformanceSecret is the name of the secret to propagate env variables from ConformanceSecret = "conformance-test-secret" // EnvKey is the configmap/secret key which contains test value EnvKey = "testKey" // EnvValue is the configmap/secret test value to match env variable with EnvValue = "testValue" // ContainerMemoryLimit is used in any test which needs a default memory resource limit ContainerMemoryLimit = "350Mi" )
const ( // PollInterval is how frequently e2e tests will poll for updates. PollInterval = 1 * time.Second // PollTimeout is how long e2e tests will wait for resource updates when polling. PollTimeout = 10 * time.Minute // HelloVolumePath is the path to the test volume. HelloVolumePath = "/hello/world" )
Variables ¶
var AppendRandomString = helpers.AppendRandomString
AppendRandomString will generate a random string that begins with prefix. This is useful if you want to make sure that your tests can run at the same time against the same environment without conflicting. This method will seed rand with the current time when called for the first time.
var MakeK8sNamePrefix = helpers.MakeK8sNamePrefix
MakeK8sNamePrefix will convert each chunk of non-alphanumeric character into a single dash and also convert camelcase tokens into dash-delimited lowercase tokens.
var ObjectNameForTest = helpers.ObjectNameForTest
ObjectNameForTest generates a random object name based on the test name.
var ServingFlags = initializeServingFlags()
ServingFlags holds the flags or defaults for knative/serving settings in the user's environment.
Functions ¶
func AssertProberDefault ¶ added in v0.4.0
AssertProberDefault is a helper for stopping the Prober and checking its SLI against the default SLO, which requires perfect responses. This takes `testing.T` so that it may be used in `defer`.
func BuildClientConfig ¶ added in v0.12.0
BuildClientConfig builds client config for testing.
func CheckSLO ¶ added in v0.4.0
CheckSLO compares the SLI of the given prober against the SLO, erroring if too low.
func CleanupOnInterrupt ¶
func CleanupOnInterrupt(cleanup func())
CleanupOnInterrupt will execute the function cleanup if an interrupt signal is caught
func ListenAndServeGracefully ¶ added in v0.3.0
func ListenAndServeGracefully(addr string, handler func(w http.ResponseWriter, r *http.Request))
ListenAndServeGracefully calls into ListenAndServeGracefullyWithPattern by passing handler to handle requests for "/"
func ListenAndServeGracefullyWithHandler ¶ added in v0.8.0
ListenAndServeGracefullyWithPattern creates an HTTP server, listens on the defined address and handles incoming requests with the given handler. It blocks until SIGTERM is received and the underlying server has shutdown gracefully.
func SubServiceNameForTest ¶ added in v0.4.0
SubServiceNameForTest generates a random service name based on the test name and the given subservice name.
func TearDown ¶ added in v0.4.0
func TearDown(clients *Clients, names ResourceNames)
TearDown will delete created names using clients.
Types ¶
type Clients ¶
type Clients struct { KubeClient *test.KubeClient ServingAlphaClient *ServingAlphaClients ServingBetaClient *ServingBetaClients ServingClient *ServingClients NetworkingClient *NetworkingClients Dynamic dynamic.Interface IstioClient istioclientset.Interface }
Clients holds instances of interfaces for making requests to Knative Serving.
func NewClients ¶
NewClients instantiates and returns several clientsets required for making request to the Knative Serving cluster specified by the combination of clusterName and configPath. Clients can make requests within namespace.
func NewClientsFromConfig ¶ added in v0.11.0
NewClientsFromConfig instantiates and returns several clientsets required for making request to the Knative Serving cluster specified by the rest Config. Clients can make requests within namespace.
type NetworkingClients ¶ added in v0.10.0
type NetworkingClients struct { ServerlessServices networkingv1alpha1.ServerlessServiceInterface Ingresses networkingv1alpha1.IngressInterface Certificates networkingv1alpha1.CertificateInterface }
NetworkingClients holds instances of interfaces for making requests to Knative networking clients.
type Prober ¶ added in v0.4.0
type Prober interface { // SLI returns the "service level indicator" for the prober, which is the observed // success rate of the probes. This will panic if the prober has not been stopped. SLI() (total int64, failures int64) // Stop terminates the prober, returning any observed errors. // Implementations may choose to put additional requirements on // the prober, which may cause this to block (e.g. a minimum number // of probes to achieve a population suitable for SLI measurement). Stop() error }
Prober is the interface for a prober, which checks the result of the probes when stopped.
func RunRouteProber ¶ added in v0.2.0
RunRouteProber starts a single Prober of the given domain.
type ProberManager ¶ added in v0.4.0
type ProberManager interface { // The ProberManager should expose a way to collectively reason about spawned // probes as a sort of aggregating Prober. Prober // Spawn creates a new Prober Spawn(url *url.URL) Prober // Foreach iterates over the probers spawned by this ProberManager. Foreach(func(url *url.URL, p Prober)) }
ProberManager is the interface for spawning probers, and checking their results.
func NewProberManager ¶ added in v0.4.0
func NewProberManager(logf logging.FormatLogger, clients *Clients, minProbes int64) ProberManager
NewProberManager creates a new manager for probes.
type ResourceNames ¶
type ResourceNames struct { Config string Route string Revision string Service string TrafficTarget string URL *url.URL Image string }
ResourceNames holds names of various resources.
type ServingAlphaClients ¶ added in v0.7.0
type ServingAlphaClients struct { Routes servingv1alpha1.RouteInterface Configs servingv1alpha1.ConfigurationInterface Revisions servingv1alpha1.RevisionInterface Services servingv1alpha1.ServiceInterface }
ServingAlphaClients holds instances of interfaces for making requests to knative serving clients
type ServingBetaClients ¶ added in v0.7.0
type ServingBetaClients struct { Routes servingv1beta1.RouteInterface Configs servingv1beta1.ConfigurationInterface Revisions servingv1beta1.RevisionInterface Services servingv1beta1.ServiceInterface }
ServingBetaClients holds instances of interfaces for making requests to knative serving clients
type ServingClients ¶ added in v0.2.0
type ServingClients struct { Routes servingv1.RouteInterface Configs servingv1.ConfigurationInterface Revisions servingv1.RevisionInterface Services servingv1.ServiceInterface }
ServingClients holds instances of interfaces for making requests to knative serving clients
type ServingEnvironmentFlags ¶ added in v0.2.0
type ServingEnvironmentFlags struct { ResolvableDomain bool // Resolve Route controller's `domainSuffix` Https bool // Indicates where the test service will be created with https IngressClass string // Indicates the class of Ingress provider to test. CertificateClass string // Indicates the class of Certificate provider to test. }
ServingEnvironmentFlags holds the e2e flags needed only by the serving repo.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
apicoverage
|
|
conformance
|
|
test_images
|
|
singlethreaded
The singlethreaded program
|
The singlethreaded program |