Documentation ¶
Index ¶
- func AssertAutoscaleUpToNumPods(ctx *TestContext, curPods, targetPods float64, done <-chan time.Time, ...)
- func AutoscaleUpToNumPods(ctx *TestContext, curPods, targetPods float64, done <-chan time.Time, ...) func() error
- func CreateAndVerifyInitialScaleConfiguration(t *testing.T, clients *test.Clients, names test.ResourceNames, wantPods int)
- func RevisionFromConfiguration(clients *test.Clients, configName string) (string, error)
- func ScaleToWithin(t *testing.T, scale int, duration time.Duration, latencies Latencies)
- func Setup(t *testing.T) *test.Clients
- func SetupAlternativeNamespace(t *testing.T) *test.Clients
- func WaitForScaleToZero(t *testing.T, deploymentName string, clients *test.Clients) error
- type Latencies
- type TestContext
- func (ctx *TestContext) Clients() *test.Clients
- func (ctx *TestContext) Names() *test.ResourceNames
- func (ctx *TestContext) Resources() *v1test.ResourceObjects
- func (ctx *TestContext) SetLogger(logf logging.FormatLogger)
- func (ctx *TestContext) SetNames(names *test.ResourceNames)
- func (ctx *TestContext) SetResources(resources *v1test.ResourceObjects)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertAutoscaleUpToNumPods ¶ added in v0.19.0
func AssertAutoscaleUpToNumPods(ctx *TestContext, curPods, targetPods float64, done <-chan time.Time, quick bool)
AssertAutoscaleUpToNumPods asserts the number of pods gets scaled to targetPods. It supports two test modes: quick, and not quick.
- Quick mode: succeeds when the number of pods meets targetPods.
- Not Quick (sustaining) mode: succeeds when the number of pods gets scaled to targetPods and sustains there until the `done` channel sends a signal.
func AutoscaleUpToNumPods ¶ added in v0.20.0
func AutoscaleUpToNumPods(ctx *TestContext, curPods, targetPods float64, done <-chan time.Time, quick bool) func() error
AutoscaleUpToNumPods starts the traffic for AssertAutoscaleUpToNumPods and returns a function to wait for which will return any error from test execution. Starting the routines is separated from waiting for easy re-use in other places (e.g. upgrade tests).
func CreateAndVerifyInitialScaleConfiguration ¶ added in v0.18.0
func CreateAndVerifyInitialScaleConfiguration(t *testing.T, clients *test.Clients, names test.ResourceNames, wantPods int)
CreateAndVerifyInitialScaleConfiguration creates a Configuration with the `initialScale` annotation set and validates the `wantPods` number of pods are created.
func RevisionFromConfiguration ¶ added in v0.28.0
Get revision name from configuration.
func ScaleToWithin ¶ added in v0.4.0
ScaleToWithin creates `scale` services in parallel subtests and reports the time taken to `latencies`.
func SetupAlternativeNamespace ¶ added in v0.6.0
SetupAlternativeNamespace creates the client objects needed in e2e tests under the alternative namespace.
Types ¶
type Latencies ¶ added in v0.4.0
type Latencies interface { // Add takes the name of this measurement and the time at which it began. // This should be called at the moment of completion, so that duration may // be computed with `time.Since(start)`. We use this signature to that this // function is suitable for use in a `defer`. Add(name string, start time.Time) }
Latencies is an interface for providing mechanisms for recording timings for the parts of the scale test.
type TestContext ¶ added in v0.19.0
type TestContext struct {
// contains filtered or unexported fields
}
TestContext includes context for autoscaler testing.
func SetupSvc ¶ added in v0.19.0
func SetupSvc(t *testing.T, class, metric string, target int, targetUtilization float64, fopts ...rtesting.ServiceOption) *TestContext
SetupSvc creates a new service, with given service options. It returns a TestContext that has resources, K8s clients and other needed data points.
func (*TestContext) Clients ¶ added in v0.19.0
func (ctx *TestContext) Clients() *test.Clients
Clients returns the clients of the TestContext.
func (*TestContext) Names ¶ added in v0.19.0
func (ctx *TestContext) Names() *test.ResourceNames
Names returns the resource names of the TestContext.
func (*TestContext) Resources ¶ added in v0.19.0
func (ctx *TestContext) Resources() *v1test.ResourceObjects
Resources returns the resources of the TestContext.
func (*TestContext) SetLogger ¶ added in v0.20.0
func (ctx *TestContext) SetLogger(logf logging.FormatLogger)
SetLogger sets the logger of the TestContext.
func (*TestContext) SetNames ¶ added in v0.19.0
func (ctx *TestContext) SetNames(names *test.ResourceNames)
SetNames set the resource names of the TestContext to the given values.
func (*TestContext) SetResources ¶ added in v0.19.0
func (ctx *TestContext) SetResources(resources *v1test.ResourceObjects)
SetResources sets the resources of the TestContext to the given values.