config

package
v0.5.23 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractVariableStorage

func ExtractVariableStorage(cfg *AmmoConfig) (*vs.SourceStorage, error)

func ParseShootName

func ParseShootName(shoot string) (string, int, int, error)

func SpreadNames

func SpreadNames(input []ScenarioConfig) (map[string]int, int)

Types

type AmmoConfig

type AmmoConfig struct {
	VariableSources []vs.VariableSource `config:"variable_sources"`
	Requests        []RequestConfig
	Calls           []CallConfig
	Scenarios       []ScenarioConfig
}

AmmoConfig is a config for dynamic converting from map[string]interface{}

func ConvertHCLToAmmo

func ConvertHCLToAmmo(ammo AmmoHCL) (*AmmoConfig, error)

func DecodeMap

func DecodeMap(bytes []byte) (*AmmoConfig, error)

func ParseAmmoConfig

func ParseAmmoConfig(file io.Reader) (*AmmoConfig, error)

func ReadAmmoConfig

func ReadAmmoConfig(fs afero.Fs, fileName string) (ammoCfg *AmmoConfig, err error)

type AmmoHCL

type AmmoHCL struct {
	VariableSources []SourceHCL   `hcl:"variable_source,block" config:"variable_sources" yaml:"variable_sources"`
	Requests        []RequestHCL  `hcl:"request,block"`
	Calls           []CallHCL     `hcl:"call,block"`
	Scenarios       []ScenarioHCL `hcl:"scenario,block"`
}

func ParseHCLFile

func ParseHCLFile(file afero.File) (AmmoHCL, error)

type AssertSizeHCL

type AssertSizeHCL struct {
	Val *int    `hcl:"val"`
	Op  *string `hcl:"op"`
}

type CallConfig

type CallConfig struct {
	Name           string
	Tag            string
	Call           string
	Payload        string
	Metadata       map[string]string
	Preprocessors  []grpcgun.Preprocessor
	Postprocessors []grpcgun.Postprocessor
}

type CallHCL

type CallHCL struct {
	Name           string                 `hcl:"name,label"`
	Tag            *string                `hcl:"tag" yaml:"tag,omitempty"`
	Call           string                 `hcl:"call"`
	Metadata       *map[string]string     `hcl:"metadata" yaml:"metadata,omitempty"`
	Payload        string                 `hcl:"payload"`
	Preprocessor   []CallPreprocessorHCL  `hcl:"preprocessor,block" yaml:"preprocessors,omitempty"`
	Postprocessors []CallPostprocessorHCL `hcl:"postprocessor,block" yaml:"postprocessors,omitempty"`
}

type CallPostprocessorHCL

type CallPostprocessorHCL struct {
	Type       string    `hcl:"type,label"`
	Payload    *[]string `hcl:"payload" yaml:"payload,omitempty"`
	StatusCode *int      `hcl:"status_code" yaml:"status_code,omitempty"`
}

type CallPreprocessorHCL

type CallPreprocessorHCL struct {
	Type    string            `hcl:"type,label"`
	Mapping map[string]string `hcl:"mapping"`
}

type RequestConfig

type RequestConfig struct {
	Name           string
	Method         string
	Headers        map[string]string
	Tag            string
	Body           *string
	URI            string
	Preprocessor   *preprocessor.Preprocessor
	Postprocessors []httpscenario.Postprocessor
	Templater      httpscenario.Templater
}

RequestConfig is a config for dynamic converting from map[string]interface{}

type RequestHCL

type RequestHCL struct {
	Name           string                    `hcl:"name,label"`
	Method         string                    `hcl:"method"`
	URI            string                    `hcl:"uri"`
	Headers        map[string]string         `hcl:"headers" yaml:"headers,omitempty"`
	Tag            *string                   `hcl:"tag" yaml:"tag,omitempty"` //TODO: remove
	Body           *string                   `hcl:"body" yaml:"body,omitempty"`
	Preprocessor   *RequestPreprocessorHCL   `hcl:"preprocessor,block" yaml:"preprocessor,omitempty"`
	Postprocessors []RequestPostprocessorHCL `hcl:"postprocessor,block" yaml:"postprocessors,omitempty"`
	Templater      *TemplaterHCL             `hcl:"templater,block" yaml:"templater,omitempty"`
}

type RequestPostprocessorHCL

type RequestPostprocessorHCL struct {
	Type       string             `hcl:"type,label"`
	Mapping    *map[string]string `hcl:"mapping" yaml:"mapping,omitempty"`
	Headers    *map[string]string `hcl:"headers" yaml:"headers,omitempty"`
	Body       *[]string          `hcl:"body" yaml:"body,omitempty"`
	StatusCode *int               `hcl:"status_code" yaml:"status_code,omitempty"`
	Size       *AssertSizeHCL     `hcl:"size,block" yaml:"size,omitempty"`
}

type RequestPreprocessorHCL

type RequestPreprocessorHCL struct {
	//Type    string            `hcl:"type,label"`
	Mapping map[string]string `hcl:"mapping"`
}

type ScenarioConfig

type ScenarioConfig struct {
	Name           string
	Weight         int64
	MinWaitingTime int64 `config:"min_waiting_time"`
	Requests       []string
}

ScenarioConfig is a config for dynamic converting from map[string]interface{}

type ScenarioHCL

type ScenarioHCL struct {
	Name           string   `hcl:"name,label"`
	Weight         *int64   `hcl:"weight" yaml:"weight,omitempty"`
	MinWaitingTime *int64   `hcl:"min_waiting_time" config:"min_waiting_time" yaml:"min_waiting_time,omitempty"`
	Requests       []string `hcl:"requests" yaml:"requests"`
}

type SourceHCL

type SourceHCL struct {
	Name            string             `hcl:"name,label"`
	Type            string             `hcl:"type,label"`
	File            *string            `hcl:"file" yaml:"file,omitempty"`
	Fields          *[]string          `hcl:"fields" yaml:"fields,omitempty"`
	IgnoreFirstLine *bool              `hcl:"ignore_first_line" yaml:"ignore_first_line,omitempty"`
	Delimiter       *string            `hcl:"delimiter" yaml:"delimiter,omitempty"`
	Variables       *map[string]string `hcl:"variables" yaml:"variables,omitempty"`
}

type TemplaterHCL

type TemplaterHCL struct {
	Type string `hcl:"type" yaml:"type"`
}

Jump to

Keyboard shortcuts

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