loadtester

package
v1.37.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const ARGUMENTS_INPUT_PREFIX = "arguments."
View Source
const TaskTypeBash = "bash"
View Source
const TaskTypeConcord = "concord"

TaskTypeConcord represents the concord type as string

View Source
const TaskTypeHelm = "helm"
View Source
const TaskTypeHelmv3 = "helmv3"
View Source
const TaskTypeKubectl = "kubectl"
View Source
const TaskTypeNGrinder = "ngrinder"
View Source
const TaskTypeShell = "cmd"

Variables

This section is empty.

Functions

func HandleHealthz

func HandleHealthz(w http.ResponseWriter, r *http.Request)

HandleHealthz handles heath check requests

func HandleNewTask

func HandleNewTask(logger *zap.SugaredLogger, taskRunner TaskRunnerInterface, authorizer *Authorizer) func(w http.ResponseWriter, r *http.Request)

HandleNewTask handles task creation requests

func ListenAndServe

func ListenAndServe(port string, timeout time.Duration, logger *zap.SugaredLogger, taskRunner *TaskRunner, gate *GateStorage, authorizer *Authorizer, stopCh <-chan struct{})

ListenAndServe starts a web server and waits for SIGTERM

Types

type Authorizer added in v1.19.0

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

func NewAuthorizer added in v1.19.0

func NewAuthorizer(namespaceRegexp *regexp.Regexp) *Authorizer

func (*Authorizer) Authorize added in v1.19.0

func (a *Authorizer) Authorize(payload *flaggerv1.CanaryWebhookPayload) bool

type BashTask

type BashTask struct {
	TaskBase
	// contains filtered or unexported fields
}

func (*BashTask) Hash

func (task *BashTask) Hash() string

func (*BashTask) Run

func (task *BashTask) Run(ctx context.Context) (*TaskRunResult, error)

func (*BashTask) String

func (task *BashTask) String() string

type CmdTask

type CmdTask struct {
	TaskBase
	// contains filtered or unexported fields
}

func (*CmdTask) Hash

func (task *CmdTask) Hash() string

func (*CmdTask) Run

func (task *CmdTask) Run(ctx context.Context) *TaskRunResult

func (*CmdTask) String

func (task *CmdTask) String() string

type ConcordTask

type ConcordTask struct {
	TaskBase
	Command      string
	Org          string
	Project      string
	Repo         string
	Entrypoint   string
	Arguments    map[string]string
	APIKeyPath   string
	Endpoint     string
	PollInterval time.Duration
	PollTimeout  time.Duration
	BaseURL      *url.URL
	// contains filtered or unexported fields
}

ConcordTask represents a concord task

func NewConcordTask

func NewConcordTask(metadata map[string]string, canary string, logger *zap.SugaredLogger) (*ConcordTask, error)

NewConcordTask instantiates a new Concord Task

func (*ConcordTask) Hash

func (task *ConcordTask) Hash() string

func (*ConcordTask) Run

func (task *ConcordTask) Run(ctx context.Context) (*TaskRunResult, error)

func (*ConcordTask) String

func (task *ConcordTask) String() string

type GateStorage

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

func NewGateStorage

func NewGateStorage(backend string) *GateStorage

type HelmTaskv3

type HelmTaskv3 struct {
	TaskBase
	// contains filtered or unexported fields
}

func (*HelmTaskv3) Hash

func (task *HelmTaskv3) Hash() string

func (*HelmTaskv3) Run

func (task *HelmTaskv3) Run(ctx context.Context) (*TaskRunResult, error)

func (*HelmTaskv3) String

func (task *HelmTaskv3) String() string

type KubectlTask added in v1.33.0

type KubectlTask struct {
	TaskBase
	// contains filtered or unexported fields
}

func (*KubectlTask) Hash added in v1.33.0

func (task *KubectlTask) Hash() string

func (*KubectlTask) Run added in v1.33.0

func (task *KubectlTask) Run(ctx context.Context) (*TaskRunResult, error)

func (*KubectlTask) String added in v1.33.0

func (task *KubectlTask) String() string

type NGrinderTask

type NGrinderTask struct {
	TaskBase
	// contains filtered or unexported fields
}

func (*NGrinderTask) CloneAndStartEndpoint

func (task *NGrinderTask) CloneAndStartEndpoint() *url.URL

nGrinder REST endpoints

func (*NGrinderTask) Hash

func (task *NGrinderTask) Hash() string

func (*NGrinderTask) PollStatus

func (task *NGrinderTask) PollStatus(ctx context.Context) bool

polling execution status of the new test and check if finished

func (*NGrinderTask) Run

func (task *NGrinderTask) Run(ctx context.Context) *TaskRunResult

initiate a clone_and_start request and get new test id from response

func (*NGrinderTask) StatusEndpoint

func (task *NGrinderTask) StatusEndpoint() *url.URL

func (*NGrinderTask) StopEndpoint

func (task *NGrinderTask) StopEndpoint() *url.URL

func (*NGrinderTask) String

func (task *NGrinderTask) String() string

type Task

type Task interface {
	Hash() string
	Run(ctx context.Context) *TaskRunResult
	String() string
	Canary() string
}

Modeling a loadtester task

type TaskBase

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

func (*TaskBase) Canary

func (task *TaskBase) Canary() string

type TaskFactory

type TaskFactory = func(metadata map[string]string, canary string, logger *zap.SugaredLogger) (Task, error)

func GetTaskFactory

func GetTaskFactory(typ string) (TaskFactory, bool)

type TaskRunResult

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

type TaskRunner

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

func NewTaskRunner

func NewTaskRunner(logger *zap.SugaredLogger, timeout time.Duration) *TaskRunner

func (*TaskRunner) Add

func (tr *TaskRunner) Add(task Task)

func (*TaskRunner) GetTotalExecs

func (tr *TaskRunner) GetTotalExecs() uint64

func (*TaskRunner) Start

func (tr *TaskRunner) Start(interval time.Duration, stopCh <-chan struct{})

func (*TaskRunner) Timeout

func (tr *TaskRunner) Timeout() time.Duration

type TaskRunnerInterface

type TaskRunnerInterface interface {
	Add(task Task)
	GetTotalExecs() uint64
	Start(interval time.Duration, stopCh <-chan struct{})
	Timeout() time.Duration
}

Jump to

Keyboard shortcuts

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