Documentation ¶
Index ¶
- Constants
- Variables
- func AddRootCAtoTransport(ctx context.Context, logf logging.FormatLogger, clients *Clients, https bool) spoof.TransportOption
- func AddTestAnnotation(t testing.TB, m metav1.ObjectMeta)
- func AssertProberDefault(t testing.TB, p Prober)
- func AssertProberSLO(t testing.TB, p Prober, slo float64)
- func CheckSLO(slo float64, name string, p Prober) error
- func CleanupOnInterrupt(cleanup func())
- func EnsureCleanup(t *testing.T, cleanup func())
- func EnsureTearDown(t *testing.T, clients *Clients, names *ResourceNames)
- func ListenAndServeGracefully(addr string, handler func(w http.ResponseWriter, r *http.Request))
- func ListenAndServeGracefullyWithHandler(addr string, handler http.Handler)
- func PemDataFromSecret(ctx context.Context, logf logging.FormatLogger, clients *Clients, ...) []byte
- func TLSClientConfig(ctx context.Context, logf logging.FormatLogger, clients *Clients) *tls.Config
- func TearDown(clients *Clients, names *ResourceNames)
- type Clients
- type NetworkingClients
- type Options
- type Prober
- type ProberManager
- type ResourceNames
- type ServingBetaClients
- type ServingClients
- type ServingEnvironmentFlags
Constants ¶
const ( // Test image names Autoscale = "autoscale" Failing = "failing" GRPCPing = "grpc-ping" HelloHTTP2 = "hellohttp2" HelloVolume = "hellovolume" HelloWorld = "helloworld" HTTPProxy = "httpproxy" InvalidHelloWorld = "invalidhelloworld" // Not a real image PizzaPlanet1 = "pizzaplanetv1" PizzaPlanet2 = "pizzaplanetv2" Readiness = "readiness" Runtime = "runtime" ServingContainer = "servingcontainer" SidecarContainer = "sidecarcontainer" SingleThreadedImage = "singlethreaded" Timeout = "timeout" Volumes = "volumes" SlowStart = "slowstart" // 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?" HelloHTTP2Text = "Hello, New World! How about donuts and coffee?" EmptyDirText = "From file in empty dir!" MultiContainerResponse = "Yay!! multi-container works" ConcurrentRequests = 200 // 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. // The CDF of the binomial distribution tells us this will flake roughly // 1 time out of 10^12 (roughly the number of galaxies in the observable universe). MinSplitPercentage = 0.25 )
Constants for test images located in test/test_images.
const ( // 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" // GatewayNamespaceOverride is the name of env variable with gateway namespace GatewayNamespaceOverride = "GATEWAY_NAMESPACE_OVERRIDE" )
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 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 AddRootCAtoTransport ¶ added in v0.14.0
func AddRootCAtoTransport(ctx context.Context, logf logging.FormatLogger, clients *Clients, https bool) spoof.TransportOption
AddRootCAtoTransport returns TransportOption when HTTPS option is true. Otherwise it returns plain spoof.TransportOption.
func AddTestAnnotation ¶ added in v0.15.0
func AddTestAnnotation(t testing.TB, m metav1.ObjectMeta)
AddTestAnnotation adds the knative-e2e-test label to the resource.
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 AssertProberSLO ¶ added in v0.20.0
AssertProberSLO is a helper for stopping the Prober and checking its SLI against the given SLO.
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 stores cleanup functions to execute if an interrupt signal is caught
func EnsureCleanup ¶ added in v0.16.0
EnsureCleanup will run the provided cleanup function when the test ends, either via t.Cleanup or on interrupt via CleanupOnInterrupt.
func EnsureTearDown ¶ added in v0.16.0
func EnsureTearDown(t *testing.T, clients *Clients, names *ResourceNames)
EnsureTearDown will delete created names when the test ends, either via t.Cleanup, or on interrupt via CleanupOnInterrupt.
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
ListenAndServeGracefullyWithHandler 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 PemDataFromSecret ¶ added in v0.14.0
func PemDataFromSecret(ctx context.Context, logf logging.FormatLogger, clients *Clients, ns, secretName string) []byte
PemDataFromSecret gets pem data from secret.
func TLSClientConfig ¶ added in v0.24.0
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 kubernetes.Interface ServingBetaClient *ServingBetaClients ServingClient *ServingClients NetworkingClient *NetworkingClients Dynamic dynamic.Interface Apiextensions *apiextensionsv1.ApiextensionsV1Client }
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 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
func RunRouteProber(logf logging.FormatLogger, clients *Clients, url *url.URL, opts ...interface{}) Prober
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, opts ...interface{}) 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 Sidecars []string }
ResourceNames holds names of various resources.
type ServingBetaClients ¶ added in v0.7.0
type ServingBetaClients struct {
DomainMappings servingv1beta1.DomainMappingInterface
}
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.
func (*ServingClients) Delete ¶ added in v0.2.0
func (clients *ServingClients) Delete(routes, configs, services []string) []error
Delete will delete all Routes and Configs with the named routes and configs, if clients have been successfully initialized.
type ServingEnvironmentFlags ¶ added in v0.2.0
type ServingEnvironmentFlags struct { ResolvableDomain bool // Resolve Route controller's `domainSuffix` CustomDomain string // Indicates the `domainSuffix` for custom domain test. HTTPS bool // Indicates where the test service will be created with https Buckets int // The number of reconciler buckets configured. Replicas int // The number of controlplane replicas being run. EnableAlphaFeatures bool // Indicates whether we run tests for alpha features EnableBetaFeatures bool // Indicates whether we run tests for beta features DisableLogStream bool // Indicates whether log streaming is disabled DisableOptionalAPI bool // Indicates whether to skip conformance tests against optional API SkipCleanupOnFail bool // Indicates whether to skip cleanup if test fails TestNamespace string // Default namespace for Serving E2E/Conformance tests AltTestNamespace string // Alternative namespace for running cross-namespace tests in TLSTestNamespace string // Namespace for Serving TLS tests ExceedingMemoryLimitSize int // Memory size used to trigger a non-200 response when the service is set with 300MB memory limit. RequestHeaders string // Extra HTTP request headers sent to the testing deployed KServices. IngressClass string // Ingress class used for serving. CustomMemoryRequests string // Memory requests used for services with a specific size. CustomMemoryLimits string // Memory limits used for services with a specific size. CustomCPURequests string // CPU requests used for services with a specific size. CustomCPULimits string // CPU limits used for services with a specific size. }
ServingEnvironmentFlags holds the e2e flags needed only by the serving repo.
func (*ServingEnvironmentFlags) RequestHeader ¶ added in v0.30.0
func (f *ServingEnvironmentFlags) RequestHeader() http.Header
RequestHeader returns a http.Header object including key-value header pairs passed via testing flag.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
conformance
|
|
api/shared
Package shared contains functions and types that can be used across various versions of conformance tests, e.g.
|
Package shared contains functions and types that can be used across various versions of conformance tests, e.g. |
test_images
|
|
singlethreaded
The singlethreaded program
|
The singlethreaded program |