Documentation
¶
Index ¶
Constants ¶
const ( FieldMethod = "method" FieldURL = "url" FieldHeader = "header" FieldBody = "body" FieldRequests = "requests" FieldConcurrency = "concurrency" FieldInterval = "interval" FieldRequestTimeout = "requestTimeout" FieldGlobalTimeout = "globalTimeout" FieldTests = "tests" )
Variables ¶
var FieldsUsage = map[string]string{ FieldMethod: "HTTP request method", FieldURL: "HTTP request url", FieldHeader: "HTTP request header", FieldBody: "HTTP request body", FieldRequests: "Number of requests to run, use duration as exit condition if omitted", FieldConcurrency: "Number of connections to run concurrently", FieldInterval: "Minimum duration between two non concurrent requests", FieldRequestTimeout: "Timeout for each HTTP request", FieldGlobalTimeout: "Max duration of test", FieldTests: "Test suite", }
FieldsUsage is a record of all available config fields and their usage.
Functions ¶
Types ¶
type Global ¶
type Global struct {
Request Request
Runner Runner
Tests []tests.Case
// contains filtered or unexported fields
}
Global represents the global configuration of the runner. It must be validated using Global.Validate before usage.
func (Global) Override ¶
Override returns a new Config by overriding the values of base with the values from the Config receiver. Only fields previously specified by the receiver via Config.WithFields are replaced. All other values from base are preserved.
The following example is equivalent to defaultConfig with the concurrency value from myConfig:
myConfig. WithFields(FieldConcurrency). Override(defaultConfig)
The following example is equivalent to defaultConfig, as no field as been tagged via WithFields by the receiver:
myConfig.Override(defaultConfig)
func (Global) String ¶
String implements fmt.Stringer. It returns an indented JSON representation of Config for debugging purposes.
func (Global) Validate ¶
Validate returns a non-nil InvalidConfigError if any of its fields does not meet the requirements.
func (Global) WithFields ¶
WithField returns a new Global with the input fields marked as set. Accepted options are limited to existing Fields, other values are silently ignored.
type InvalidConfigError ¶
type InvalidConfigError struct {
Errors []error
}
InvalidConfigError is the errors returned by Global.Validate when values are missing or invalid.
func (*InvalidConfigError) Error ¶
func (e *InvalidConfigError) Error() string
Error returns the joined errors of InvalidConfigError as a string.
type Request ¶
Request contains the confing options relative to a single request.
type RequestBody ¶
RequestBody represents a request body associated with a type. The type affects the way the content is processed. If Type == "file", Content is read as a filepath to be resolved. If Type == "raw", Content is attached as-is.
Note: only "raw" is supported at the moment.
func NewRequestBody ¶
func NewRequestBody(typ, content string) RequestBody
NewRequestBody returns a Body initialized with the given type and content. For now, the only valid value for type is "raw".