Documentation ¶
Overview ¶
Example (EncodeAmmoHCLVariablesSources) ¶
app := AmmoHCL{ VariableSources: []SourceHCL{ { Type: "file/csv", Name: "user_srs", File: pointer.ToString("users.json"), Fields: &([]string{"id", "name", "email"}), }, { Type: "file/json", Name: "data_srs", File: pointer.ToString("datas.json"), Fields: &([]string{"id", "name", "email"}), }, }, } f := hclwrite.NewEmptyFile() gohcl.EncodeIntoBody(&app, f.Body()) bytes := f.Bytes() fmt.Printf("%s", bytes)
Output: variable_source "user_srs" "file/csv" { file = "users.json" fields = ["id", "name", "email"] } variable_source "data_srs" "file/json" { file = "datas.json" fields = ["id", "name", "email"] }
Index ¶
- func Import(fs afero.Fs)
- func NewProvider(fs afero.Fs, conf Config) (core.Provider, error)
- func RegisterPostprocessor(name string, mwConstructor interface{}, defaultConfigOptional ...interface{})
- func RegisterTemplater(name string, mwConstructor interface{}, defaultConfigOptional ...interface{})
- func RegisterVariableSource(name string, mwConstructor interface{}, defaultConfigOptional ...interface{})
- type Ammo
- type AmmoConfig
- type AmmoHCL
- type AssertSizeHCL
- type Config
- type HTMLTemplater
- type PostprocessorHCL
- type Preprocessor
- type PreprocessorHCL
- type Provider
- type Request
- func (r *Request) GetBody() []byte
- func (r *Request) GetHeaders() map[string]string
- func (r *Request) GetMethod() string
- func (r *Request) GetName() string
- func (r *Request) GetPostProcessors() []httpscenario.Postprocessor
- func (r *Request) GetSleep() time.Duration
- func (r *Request) GetTag() string
- func (r *Request) GetTemplater() httpscenario.Templater
- func (r *Request) GetURL() string
- func (r *Request) Preprocessor() httpscenario.Preprocessor
- type RequestConfig
- type RequestHCL
- type ScenarioConfig
- type ScenarioHCL
- type SourceHCL
- type SourceStorage
- type Templater
- type TextTemplater
- type VariableSource
- type VariableSourceCsv
- type VariableSourceJSON
- type VariableSourceVariables
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterPostprocessor ¶
func RegisterPostprocessor(name string, mwConstructor interface{}, defaultConfigOptional ...interface{})
func RegisterTemplater ¶
func RegisterTemplater(name string, mwConstructor interface{}, defaultConfigOptional ...interface{})
func RegisterVariableSource ¶
func RegisterVariableSource(name string, mwConstructor interface{}, defaultConfigOptional ...interface{})
Types ¶
type Ammo ¶
type Ammo struct { Requests []Request // contains filtered or unexported fields }
func (*Ammo) GetMinWaitingTime ¶
func (*Ammo) Sources ¶
func (a *Ammo) Sources() httpscenario.VariableStorage
func (*Ammo) Steps ¶
func (a *Ammo) Steps() []httpscenario.Step
type AmmoConfig ¶
type AmmoConfig struct { VariableSources []VariableSource `config:"variable_sources"` Requests []RequestConfig Scenarios []ScenarioConfig }
func ConvertHCLToAmmo ¶
func ConvertHCLToAmmo(ammo AmmoHCL, fs afero.Fs) (AmmoConfig, error)
func ParseAmmoConfig ¶
func ParseAmmoConfig(file io.Reader) (AmmoConfig, error)
type AmmoHCL ¶
type AmmoHCL struct { VariableSources []SourceHCL `hcl:"variable_source,block"` Requests []RequestHCL `hcl:"request,block"` Scenarios []ScenarioHCL `hcl:"scenario,block"` }
func ConvertAmmoToHCL ¶
func ConvertAmmoToHCL(ammo AmmoConfig) (AmmoHCL, error)
type AssertSizeHCL ¶
type HTMLTemplater ¶
type HTMLTemplater struct {
// contains filtered or unexported fields
}
func (*HTMLTemplater) Apply ¶
func (t *HTMLTemplater) Apply(parts *httpscenario.RequestParts, vs map[string]any, scenarioName, stepName string) error
type PostprocessorHCL ¶
type Preprocessor ¶
type PreprocessorHCL ¶
type Provider ¶
type Provider struct { base.ProviderBase // contains filtered or unexported fields }
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
func (*Request) GetHeaders ¶
func (*Request) GetPostProcessors ¶
func (r *Request) GetPostProcessors() []httpscenario.Postprocessor
func (*Request) GetTemplater ¶
func (r *Request) GetTemplater() httpscenario.Templater
func (*Request) Preprocessor ¶
func (r *Request) Preprocessor() httpscenario.Preprocessor
type RequestConfig ¶
type RequestConfig struct { Name string Method string Headers map[string]string Tag string Body *string URI string Preprocessor Preprocessor Postprocessors []postprocessor.Postprocessor Templater Templater }
type RequestHCL ¶
type RequestHCL struct { Name string `hcl:"name,label"` Method string `hcl:"method"` Headers map[string]string `hcl:"headers"` Tag *string `hcl:"tag"` Body *string `hcl:"body"` URI string `hcl:"uri"` Preprocessor *PreprocessorHCL `hcl:"preprocessor,block"` Postprocessors []PostprocessorHCL `hcl:"postprocessor,block"` Templater *string `hcl:"templater"` }
type ScenarioConfig ¶
type ScenarioHCL ¶
type SourceStorage ¶
type SourceStorage struct {
// contains filtered or unexported fields
}
func (*SourceStorage) AddSource ¶
func (s *SourceStorage) AddSource(name string, variables any)
func (*SourceStorage) Variables ¶
func (s *SourceStorage) Variables() map[string]any
type Templater ¶
type Templater interface {
Apply(request *httpscenario.RequestParts, variables map[string]any, scenarioName, stepName string) error
}
func NewHTMLTemplater ¶
func NewHTMLTemplater() Templater
func NewTextTemplater ¶
func NewTextTemplater() Templater
type TextTemplater ¶
type TextTemplater struct {
// contains filtered or unexported fields
}
func (*TextTemplater) Apply ¶
func (t *TextTemplater) Apply(parts *httpscenario.RequestParts, vs map[string]any, scenarioName, stepName string) error
type VariableSource ¶
func NewVSCSV ¶
func NewVSCSV(cfg VariableSourceCsv, fs afero.Fs) (VariableSource, error)
func NewVSJson ¶
func NewVSJson(cfg VariableSourceJSON, fs afero.Fs) (VariableSource, error)
type VariableSourceCsv ¶
type VariableSourceCsv struct { Name string File string Fields []string IgnoreFirstLine bool `config:"ignore_first_line"` Delimiter string // contains filtered or unexported fields }
func (*VariableSourceCsv) GetName ¶
func (v *VariableSourceCsv) GetName() string
func (*VariableSourceCsv) GetVariables ¶
func (v *VariableSourceCsv) GetVariables() any
func (*VariableSourceCsv) Init ¶
func (v *VariableSourceCsv) Init() (err error)
type VariableSourceJSON ¶
type VariableSourceJSON struct { Name string File string // contains filtered or unexported fields }
func (*VariableSourceJSON) GetName ¶
func (v *VariableSourceJSON) GetName() string
func (*VariableSourceJSON) GetVariables ¶
func (v *VariableSourceJSON) GetVariables() any
func (*VariableSourceJSON) Init ¶
func (v *VariableSourceJSON) Init() (err error)
type VariableSourceVariables ¶
func (*VariableSourceVariables) GetName ¶
func (v *VariableSourceVariables) GetName() string
func (*VariableSourceVariables) GetVariables ¶
func (v *VariableSourceVariables) GetVariables() any
func (*VariableSourceVariables) Init ¶
func (v *VariableSourceVariables) Init() error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.