loadtest

package
v1.12.2-rc.1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2023 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fortio

type Fortio struct {
	// contains filtered or unexported fields
}

Fortio is used for executing tests using the fortio load testing tool.

func NewFortio

func NewFortio(options ...Opt) *Fortio

NewFortio returns a fortio load tester is on given options.

func (*Fortio) Result

func (f *Fortio) Result() []byte

Result get the load test result.

func (*Fortio) Run

func (f *Fortio) Run(platform runner.PlatformInterface) error

func (*Fortio) SetParams

func (f *Fortio) SetParams(params perf.TestParameters) *Fortio

SetParams set test parameters.

type K6

type K6 struct {
	// contains filtered or unexported fields
}

K6 is used for executing tests using the k6 load testing tool.

func NewK6

func NewK6(scriptPath string, opts ...K6Opt) *K6

NewK6 creates a new k6 load testing with the given options.

func (*K6) Dispose

func (k6 *K6) Dispose() error

Dispose deletes the test resource.

func (*K6) Run

func (k6 *K6) Run(platform runner.PlatformInterface) error

Run based on platform.

type K6CounterMetric

type K6CounterMetric struct {
	Type     string `json:"type"`
	Contains string `json:"contains"`
	Values   struct {
		Count float64 `json:"count"`
		Rate  float64 `json:"rate"`
	} `json:"values"`
}

K6CounterMetric is a metric that has only count and rate

type K6GaugeMetric

type K6GaugeMetric struct {
	Type     string `json:"type"`
	Contains string `json:"contains"`
	Values   struct {
		Max int `json:"max"`
		P90 int `json:"p(90)"`
		P95 int `json:"p(95)"`
		Avg int `json:"avg"`
		Min int `json:"min"`
		Med int `json:"med"`
	} `json:"values"`
}

K6GaugeMetric is the representation of a k6 gauge

type K6Interface

type K6Interface interface {
	Create(ctx context.Context, k6 *v1.K6) (*v1.K6, error)
	Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error
	Get(ctx context.Context, name string) (*v1.K6, error)
	List(ctx context.Context, opts metav1.ListOptions) (result *v1.K6List, err error)
}

type K6Opt

type K6Opt = func(*K6)

func DisableDapr

func DisableDapr() K6Opt

DisableDapr disable dapr on runner.

func EnableLog

func EnableLog() K6Opt

EnableLog enables the console output debugging. This should be deactivated when running in production to avoid errors when parsing the test result.

func WithAppID

func WithAppID(appID string) K6Opt

WithAppID sets the appID when dapr is enabled.

func WithCtx

func WithCtx(ctx context.Context) K6Opt

WithCtx sets the test context.

func WithMemoryLimits

func WithMemoryLimits(daprRequest, daprLimit, appRequest, appLimit string) K6Opt

WithMemoryLimits set app and dapr memory limits

func WithName

func WithName(name string) K6Opt

WithName sets the test name.

func WithNamespace

func WithNamespace(namespace string) K6Opt

WithNamespace sets the test namespace.

func WithParallelism

func WithParallelism(p int) K6Opt

WithParallelism configures the number of parallel runners at once.

func WithRunnerEnvVar

func WithRunnerEnvVar(name, value string) K6Opt

WithRunnerEnvVar adds a new env variable to the runner.

func WithRunnerImage

func WithRunnerImage(image string) K6Opt

WithRunnerImage sets the runner image, defaults to k6-custom.

func WithScript

func WithScript(script string) K6Opt

WithScript set the test script.

type K6RateMetric

type K6RateMetric struct {
	Type     string `json:"type"`
	Contains string `json:"contains"`
	Values   struct {
		Rate   float64 `json:"rate"`
		Passes int     `json:"passes"`
		Fails  int     `json:"fails"`
	} `json:"values"`
}

K6Rate metric is the representation of a k6 rate metric

type K6RunnerMetricsSummary

type K6RunnerMetricsSummary struct {
	Iterations                         K6CounterMetric `json:"iterations"`
	HTTPReqConnecting                  K6TrendMetric   `json:"http_req_connecting"`
	HTTPReqTLSHandshaking              K6TrendMetric   `json:"http_req_tls_handshaking"`
	HTTPReqReceiving                   K6TrendMetric   `json:"http_req_receiving"`
	HTTPReqWaiting                     K6TrendMetric   `json:"http_req_waiting"`
	HTTPReqSending                     K6TrendMetric   `json:"http_req_sending"`
	Checks                             K6RateMetric    `json:"checks"`
	DataReceived                       K6CounterMetric `json:"data_received"`
	VusMax                             K6GaugeMetric   `json:"vus_max"`
	HTTPReqDurationExpectedResponse    *K6TrendMetric  `json:"http_req_duration{expected_response:true}"`
	HTTPReqDurationNonExpectedResponse *K6TrendMetric  `json:"http_req_duration{expected_response:false}"`
	Vus                                K6GaugeMetric   `json:"vus"`
	HTTPReqFailed                      K6RateMetric    `json:"http_req_failed"`
	IterationDuration                  K6TrendMetric   `json:"iteration_duration"`
	HTTPReqBlocked                     K6TrendMetric   `json:"http_req_blocked"`
	HTTPReqs                           K6CounterMetric `json:"http_http_reqs"`
	DataSent                           K6CounterMetric `json:"data_sent"`
	HTTPReqDuration                    K6TrendMetric   `json:"http_req_duration"`
}

K6RunnerMetricsSummary represents a single unit of testing result.

type K6RunnerSummary

type K6RunnerSummary[T any] struct {
	Metrics T `json:"metrics"`
}

type K6TestSummary

type K6TestSummary[T any] struct {
	Pass           bool `json:"pass"`
	RunnersResults []*T `json:"runnersResults"`
}

K6TestSummary is the wrapped k6 results collected for all runners.

func K6Result

func K6Result[T any](k6 *K6) (*K6TestSummary[T], error)

K6Result extract the test summary results from pod logs.

func K6ResultDefault

func K6ResultDefault(k6 *K6) (*K6TestSummary[K6RunnerMetricsSummary], error)

K6ResultDefault exports results to k6 default metrics.

type K6TrendMetric

type K6TrendMetric struct {
	Type     string `json:"type"`
	Contains string `json:"contains"`
	Values   struct {
		Max float64 `json:"max"`
		P90 float64 `json:"p(90)"`
		P95 float64 `json:"p(95)"`
		Avg float64 `json:"avg"`
		Min float64 `json:"min"`
		Med float64 `json:"med"`
	} `json:"values"`
}

K6TrendMetric is the representation of a k6 trendmetric

type Opt

type Opt = func(*Fortio)

func WithAffinity

func WithAffinity(affinityLabel string) Opt

WithAffinity sets the pod affinity for the fortio pod.

func WithNumHealthChecks

func WithNumHealthChecks(hc int) Opt

WithNumHealthChecks set the number of initial healthchecks that should be made before executing the test.

func WithParams

func WithParams(params perf.TestParameters) Opt

WithParams set the test parameters.

func WithTestAppName

func WithTestAppName(testAppName string) Opt

WithTestAppName sets the app name to be used.

func WithTesterImage

func WithTesterImage(image string) Opt

WithTesterImage sets the tester image (defaults to perf-tester).

Jump to

Keyboard shortcuts

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