artillery

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: May 11, 2022 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultManifestDir = "artillery-manifests"
View Source
const DefaultScriptsDir = "artillery-scripts"
View Source
const JobTestScriptVol = "test-script"

JobTestScriptVol the volume used by created Pods to load the test script ConfigMap.

View Source
const LabelPrefix = "artilleryio-test"
View Source
const TestFilename = "test-job.yaml"
View Source
const WorkerImage = "artilleryio/artillery:latest"

WorkerImage the Artillery image used by workers to run tests.

Variables

This section is empty.

Functions

func CopyFileTo

func CopyFileTo(dir string, srcPath string) error

CopyFileTo copies a file to directory from a specified path

func DirOrFileExists

func DirOrFileExists(path string) bool

DirOrFileExists checks whether a directory or file exists.

func MkdirAllTargetOrDefault

func MkdirAllTargetOrDefault(workingDir, targetDir, defaultDir string) (string, error)

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.

func NewIOLogger

func NewIOLogger(stdOut io.Writer, stdErr io.Writer) logr.Logger

NewIOLogger returns a simple configurable logger implementation.

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.

func (Generatables) Generate

func (gs Generatables) Generate(indent int) (string, error)

Generate generates files for all Generatables.

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) Enabled

func (l *IOLogger) Enabled() bool

Enabled fulfills the logger interface.

func (*IOLogger) Error

func (l *IOLogger) Error(err error, msg string, keysAndValues ...interface{})

Error prints error style logs to stdErr

func (*IOLogger) Info

func (l *IOLogger) Info(msg string, keysAndValues ...interface{})

Info prints info style logs to stdOut

func (*IOLogger) V

func (l *IOLogger) V(_ int) logr.Logger

V fulfills the logger interface.

func (*IOLogger) WithName

func (l *IOLogger) WithName(_ string) logr.Logger

WithName fulfills the logger interface.

func (*IOLogger) WithValues

func (l *IOLogger) WithValues(keysAndValues ...interface{}) logr.Logger

WithValues appends log keys and values to every log message

type Job

type Job struct {
	*v1.Job
}

func NewTestJob

func NewTestJob(testName, namespace, configMapName, testScriptFilename string, count int, cfg telemetry.Config) *Job

NewTestJob returns a configured Kubernetes Job wrapper for an Artillery test.

func (*Job) MarshalWithIndent

func (j *Job) MarshalWithIndent(indent int) ([]byte, error)

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.

Jump to

Keyboard shortcuts

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