Documentation ¶
Index ¶
- Constants
- func CopyFileTo(dir string, srcPath string) error
- func DirOrFileExists(path string) bool
- func MkdirAllTargetOrDefault(workingDir, targetDir, defaultDir string) (string, error)
- func NewIOLogger(stdOut io.Writer, stdErr io.Writer) logr.Logger
- type CLISettings
- type Config
- type Environment
- type Flow
- type Generatable
- type Generatables
- type GetFlow
- type IOLogger
- func (l *IOLogger) Enabled() bool
- func (l *IOLogger) Error(err error, msg string, keysAndValues ...interface{})
- func (l *IOLogger) Info(msg string, keysAndValues ...interface{})
- func (l *IOLogger) V(_ int) logr.Logger
- func (l *IOLogger) WithName(_ string) logr.Logger
- func (l *IOLogger) WithValues(keysAndValues ...interface{}) logr.Logger
- type Job
- type Kustomization
- type Phase
- type Scenario
- type StatusCode
- type TelemetryCLISettings
- type TestScript
Constants ¶
const DefaultManifestDir = "artillery-manifests"
const DefaultScriptsDir = "artillery-scripts"
const JobTestScriptVol = "test-script"
JobTestScriptVol the volume used by created Pods to load the test script ConfigMap.
const LabelPrefix = "artilleryio-test"
const TestFilename = "test-job.yaml"
const WorkerImage = "artilleryio/artillery:latest"
WorkerImage the Artillery image used by workers to run tests.
Variables ¶
This section is empty.
Functions ¶
func CopyFileTo ¶
CopyFileTo copies a file to directory from a specified path
func DirOrFileExists ¶
DirOrFileExists checks whether a directory or file exists.
func MkdirAllTargetOrDefault ¶
MkdirAllTargetOrDefault creates all directories for a target directory, taking the working directory into account. A default directory is used when the target is not supplied.
Types ¶
type CLISettings ¶
type CLISettings struct { File string `yaml:"-" json:"-"` Analytics *TelemetryCLISettings `yaml:"kubectl-artillery,omitempty" json:"kubectl-artillery,omitempty"` }
CLISettings defines global settings used by the kubectl-artillery CLI.
func GetOrCreateCLISettings ¶
func GetOrCreateCLISettings() (*CLISettings, error)
GetOrCreateCLISettings retrieves the kubectl-artillery CLI settings. Creates a new settings file if one doesn't already exist.
func (*CLISettings) GetFirstRun ¶
func (s *CLISettings) GetFirstRun() bool
GetFirstRun returns if this is the first run of kubectl-artillery CLI.
func (*CLISettings) Save ¶
func (s *CLISettings) Save() error
Save writes the kubectl-artillery CLI settings to a file.
func (*CLISettings) SetFirstRun ¶
func (s *CLISettings) SetFirstRun(b bool) *CLISettings
SetFirstRun configures the first run of kubectl-artillery CLI.
type Config ¶
type Config struct { Target string `json:"target" yaml:"target"` Phases []Phase `json:"phases,omitempty" yaml:"phases,omitempty"` Environments map[string]Environment `json:"environments,omitempty" yaml:"environments,omitempty"` }
Config defines a test script's config.
type Environment ¶
type Environment struct { Phases []Phase `json:"phases" yaml:"phases"` Target string `json:"target,omitempty" yaml:"target,omitempty"` Plugins map[string]interface{} `json:"plugins" yaml:"plugins"` }
Environment defines a test script's environment.
type Flow ¶
type Flow struct {
GetFlow GetFlow `json:"get,omitempty" yaml:"get,omitempty"`
}
Flow defines a test script's flow.
type Generatable ¶
type Generatable struct { Path string Marshaler fileMarshaler }
Generatable defines where and how (using the Marshaler) to generate a file.
type Generatables ¶
type Generatables []Generatable
Generatables a convenience type that defines a list of Generatable types.
type GetFlow ¶
type GetFlow struct { Url string `json:"url,omitempty" yaml:"url,omitempty"` Expect []StatusCode `json:"expect,omitempty" yaml:"expect,omitempty"` }
GetFlow defines a test script's get flow.
type IOLogger ¶
type IOLogger struct {
// contains filtered or unexported fields
}
IOLogger stdOut and stdErr targeted logger.
func (*IOLogger) WithValues ¶
WithValues appends log keys and values to every log message
type Job ¶
type Kustomization ¶
type Kustomization struct {
*types.Kustomization
}
Kustomization wrapper to enable marshaling a Kustomization to a file.
func NewKustomization ¶
func NewKustomization(testFilename, namespace, configMap, testScript, labelPrefix string) *Kustomization
NewKustomization returns a configured Kustomization wrapper for an Artillery test.
func (*Kustomization) MarshalWithIndent ¶
func (k *Kustomization) MarshalWithIndent(indent int) ([]byte, error)
MarshalWithIndent marshals a Kustomization using a specified indentation.
type Phase ¶
type Phase struct { Duration int `json:"duration,omitempty" yaml:"duration,omitempty"` ArrivalCount int `json:"arrivalCount,omitempty" yaml:"arrivalCount,omitempty"` ArrivalRate int `json:"arrivalRate,omitempty" yaml:"arrivalRate,omitempty"` }
Phase defines a test script's phase.
type Scenario ¶
type Scenario struct {
Flows []Flow `json:"flow,omitempty" yaml:"flow,omitempty"`
}
Scenario defines a test script's scenario.
type StatusCode ¶
type StatusCode struct {
Code int `json:"statusCode,omitempty" yaml:"statusCode,omitempty"`
}
StatusCode HTTP status code for a test script's get flow
type TelemetryCLISettings ¶
type TelemetryCLISettings struct {
FirstRun *bool `yaml:"telemetry-first-run-msg,omitempty" json:"telemetry-first-run-msg,omitempty"`
}
TelemetryCLISettings telemetry specific settings.
type TestScript ¶
type TestScript struct { Config Config `json:"config" yaml:"config"` Scenarios []Scenario `json:"scenarios" yaml:"scenarios"` }
TestScript defines a simple Artillery test script. Mainly used to generate a test script YAML config. See: https://www.artillery.io/docs/guides/guides/test-script-reference
func NewTestScript ¶
func NewTestScript(probes kube.ServiceProbes) *TestScript
NewTestScript returns an Artillery test script configured to run HTTP functional tests for provided services, targeting a service's exposed healthcheck probes.
func (*TestScript) MarshalWithIndent ¶
func (t *TestScript) MarshalWithIndent(indent int) ([]byte, error)
MarshalWithIndent marshals a TestScript using a specified indentation.