Documentation
¶
Index ¶
- Variables
- func ApiURL(k6CloudHostEnvVar string) string
- func CreateTestRun(opts InspectOutput, instances int32, host, token string, log logr.Logger) (*cloudapi.CreateTestRunResponse, error)
- func DeRegisterPLZ(client *cloudapi.Client, name string) error
- func DecodeAggregationConfig(encoded string) ([]corev1.EnvVar, error)
- func EncodeAggregationConfig(testRun *cloudapi.Config) string
- func FinishTestRun(c *cloudapi.Client, refID string) error
- func K6CloudHost() string
- func NewClient(log logr.Logger, token, host string) *cloudapi.Client
- func RegisterPLZ(client *cloudapi.Client, data PLZRegistrationData) error
- func SendTestRunEvents(client *cloudapi.Client, refID string, log logr.Logger, events *Events)
- type ErrorCode
- type Event
- type EventPayload
- type EventType
- type Events
- type InspectOutput
- type LZConfig
- type Origin
- type PLZRegistrationData
- type PLZResources
- type TestRun
- type TestRunData
- type TestRunPoller
- type TestRunStatus
Constants ¶
This section is empty.
Variables ¶
View Source
var ( SetupError = ErrorCode(8030) TeardownError = ErrorCode(8031) OOMError = ErrorCode(8032) PanicError = ErrorCode(8033) UnknownError = ErrorCode(8034) ScriptException = ErrorCode(8035) K6OperatorStartError = ErrorCode(8050) K6OperatorAbortError = ErrorCode(8051) K6OperatorRunnerError = ErrorCode(8052) )
View Source
var ( OriginUser = Origin("user") OriginK6 = Origin("k6") )
Functions ¶
func CreateTestRun ¶
func CreateTestRun(opts InspectOutput, instances int32, host, token string, log logr.Logger) (*cloudapi.CreateTestRunResponse, error)
func DeRegisterPLZ ¶ added in v0.0.10
func DecodeAggregationConfig ¶ added in v0.0.10
func EncodeAggregationConfig ¶ added in v0.0.10
func K6CloudHost ¶ added in v0.0.21
func K6CloudHost() string
func RegisterPLZ ¶ added in v0.0.10
func RegisterPLZ(client *cloudapi.Client, data PLZRegistrationData) error
Types ¶
type Event ¶ added in v0.0.12
type Event struct {
Origin `json:"origin,omitempty"`
ErrorCode `json:"error_code,omitempty"`
// reason is used for abort events,
// while details are for any non-abort event
Reason string `json:"reason,omitempty"`
Detail string `json:"error_detail,omitempty"`
PublicDetail string `json:"error_detail_public,omitempty"`
}
type EventPayload ¶ added in v0.0.12
func AbortEvent ¶ added in v0.0.12
func AbortEvent(o Origin) *EventPayload
type Events ¶ added in v0.0.12
type Events []*EventPayload
func ErrorEvent ¶ added in v0.0.12
func (*Events) WithAbort ¶ added in v0.0.12
WithAbort adds abortEvent to errorEvent if it already exists.
func (*Events) WithDetail ¶ added in v0.0.12
WithDetail sets detail only for the 1st event. If it's abort, WithDetail sets reason field.
type InspectOutput ¶
type InspectOutput struct {
External struct {
Loadimpact struct {
Name string `json:"name"`
ProjectID int64 `json:"projectID"`
} `json:"loadimpact"`
} `json:"ext"`
Cloud struct {
Name string `json:"name"`
ProjectID int64 `json:"projectID"`
} `json:"cloud"`
TotalDuration types.NullDuration `json:"totalDuration"`
MaxVUs uint64 `json:"maxVUs"`
Thresholds map[string]*metrics.Thresholds `json:"thresholds,omitempty"`
}
InspectOutput is the parsed output from `k6 inspect --execution-requirements`.
func (*InspectOutput) ProjectID ¶ added in v0.0.14
func (io *InspectOutput) ProjectID() int64
ProjectID returns the project ID from the inspect output.
func (*InspectOutput) SetTestName ¶ added in v0.0.14
func (io *InspectOutput) SetTestName(name string)
SetTestName sets the name in the inspect output.
func (*InspectOutput) TestName ¶ added in v0.0.14
func (io *InspectOutput) TestName() string
TestName returns the test name from the inspect output.
type LZConfig ¶ added in v0.0.10
type PLZRegistrationData ¶ added in v0.0.10
type PLZRegistrationData struct {
// defined by user as `name`
LoadZoneID string `json:"k6_load_zone_id"`
Resources PLZResources `json:"pod_tiers"`
LZConfig `json:"config"`
// Unique identifier of PLZ, generated by k6-operator
// during PLZ registration. It's purpose is to distinguish
// between PLZs with accidentally duplicate names.
UID string `json:"provider_id"`
}
PLZRegistrationData holds info that needs to be sent to /v1/load-zones
type PLZResources ¶ added in v0.0.10
type TestRunData ¶ added in v0.0.10
type TestRunData struct {
TestRunId int `json:"id"`
Instances int `json:"instances"`
LZConfig `json:"k8s_load_zones_config"`
RunStatus cloudapi.RunStatus `json:"run_status"`
RuntimeConfig cloudapi.Config `json:"k6_runtime_config"`
}
TestRunData holds the output from /loadtests/v4/test_runs(%s)
func GetTestRunData ¶ added in v0.0.10
func GetTestRunData(client *cloudapi.Client, refID string) (*TestRunData, error)
called by PLZworker
func (*TestRunData) TestRunID ¶ added in v0.0.10
func (trd *TestRunData) TestRunID() string
type TestRunPoller ¶ added in v0.0.10
type TestRunPoller struct {
*conn.Poller
Client *cloudapi.Client
// contains filtered or unexported fields
}
func NewTestRunPoller ¶ added in v0.0.10
func NewTestRunPoller(host, token, plzName string, logger logr.Logger) *TestRunPoller
func (*TestRunPoller) GetTestRuns ¶ added in v0.0.10
func (poller *TestRunPoller) GetTestRuns() chan string
type TestRunStatus ¶ added in v0.0.10
func GetTestRunState ¶ added in v0.0.10
called by TestRun controller
func (TestRunStatus) Aborted ¶ added in v0.0.10
func (trs TestRunStatus) Aborted() bool
Click to show internal directories.
Click to hide internal directories.