Documentation
¶
Index ¶
- Constants
- Variables
- func AppendToBaseName(filePath string, strs ...string) string
- func FlattenMultiError(mErr *multierror.Error) error
- func GenerateXrfKey(rnd Randomizer) string
- func GetFileNameFromHTTPHeader(headers http.Header) (string, error)
- func HasDeprecatedFields(rawJson []byte, deprecatedPaths []string) error
- func IsContextTriggered(ctx context.Context) bool
- func Max[T constraints.Ordered](a, b T) T
- func Min[T constraints.Ordered](a, b T) T
- func MultiErrorAppend(baseErr error, appendErr ...error) error
- func NearlyEqual(a, b float64) bool
- func NearlyEqualEpsilon(a, b float64, epsilon float64) bool
- func RankedCause(err error, ranker func(error) int) (int, error)
- func RecoverWithError(panicErr *error)
- func RecoverWithErrorFunc(f func()) error
- func ToValidWindowsFileName(fileName string) string
- func TrueCause(err error) error
- func WaitFor(ctx context.Context, duration time.Duration)
- func WriteToFile(filePath string, data []byte) error
- type Buffer
- type BufferPool
- type DataPath
- func (path DataPath) Contains(val string) bool
- func (path DataPath) Lookup(data json.RawMessage) (json.RawMessage, error)
- func (path DataPath) LookupMulti(data json.RawMessage, separator string) ([]json.RawMessage, error)
- func (path DataPath) LookupNoQuotes(data json.RawMessage) (json.RawMessage, error)
- func (path DataPath) Set(data []byte, newValue []byte) ([]byte, error)
- func (path *DataPath) String() string
- type DistributionSettings
- func (settings DistributionSettings) GetActionInfo() string
- func (settings DistributionSettings) GetMax() (float64, error)
- func (settings DistributionSettings) GetMin() (float64, error)
- func (settings DistributionSettings) RandDuration(rnd Randomizer) (time.Duration, error)
- func (settings DistributionSettings) Validate() ([]string, error)
- type DistributionType
- type FuzzyBool
- type FuzzyInt
- type NoDataFound
- type NoStepsError
- type Params
- type Password
- type Randomizer
- type RowFile
- type SyncCounter
- type TimeDuration
- type TimerPool
- type TreatAs
- type UniqueInts
- type WorkerPool
Constants ¶
const (
DefaultEpsilon = 0.000000001
)
const (
XrfKeySize = 16
)
Variables ¶
var (
FloatMinNormal = math.Float64frombits(0x00800000)
)
var GlobalBufferPool = NewBufferPool()
var GlobalTimerPool = NewTimerPool()
var (
XrfKeyChars = []rune("abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ0123456789")
)
Functions ¶
func AppendToBaseName ¶ added in v0.8.0
func FlattenMultiError ¶
func FlattenMultiError(mErr *multierror.Error) error
FlattenMultiError return nil or original error if multierror does not have more than one error
func GenerateXrfKey ¶ added in v0.14.5
func GenerateXrfKey(rnd Randomizer) string
func GetFileNameFromHTTPHeader ¶ added in v0.8.0
GetFileNameFromHTTPHeader returns the first filename found in content-disposition header.
func HasDeprecatedFields ¶ added in v0.6.8
HasDeprecatedFields check json if keys exist at provided paths, if any exist report error
func IsContextTriggered ¶
IsContextTriggered check if context is "done"
func Max ¶ added in v0.18.10
func Max[T constraints.Ordered](a, b T) T
Max returns the greatest of a and b
func Min ¶ added in v0.18.10
func Min[T constraints.Ordered](a, b T) T
Min returns the least of a and b
func MultiErrorAppend ¶ added in v0.21.7
MultiErrorAppend helper for test cases to append list of errors to multi error without direct import of multi error package
func NearlyEqual ¶ added in v0.11.5
func NearlyEqualEpsilon ¶ added in v0.11.5
NearlyEqual float points covering some edge cases as per https://floating-point-gui.de/errors/comparison/#look-out-for-edge-cases
func RankedCause ¶ added in v0.21.7
RankedCause helper to filter through hierarchy of errors to find most suitable cause to expose ranker: should return the most important cause as the higher number
func RecoverWithError ¶
func RecoverWithError(panicErr *error)
RecoverWithError recovers from panic and sets error to panicErr
func RecoverWithErrorFunc ¶ added in v0.6.17
func RecoverWithErrorFunc(f func()) error
RecoverWithErrorFunc recovers from panic and returns panic error
func ToValidWindowsFileName ¶ added in v0.8.0
func TrueCause ¶ added in v0.5.7
TrueCause of error, in the case of a multi error, the first error in list will be used
func WriteToFile ¶ added in v0.8.0
WriteToFile writes data to file defined by filePath
Types ¶
type Buffer ¶
func (*Buffer) String ¶
String returns the contents of the unread portion of the buffer as a string. If the Buffer is a nil pointer, it returns "<nil>".
func (*Buffer) WriteByte ¶
WriteByte appends the byte c to the buffer, growing the buffer as needed.
func (*Buffer) WriteBytes ¶
Write bytes to buffer, errors written to stderr
func (*Buffer) WriteRune ¶
WriteRune appends the UTF-8 encoding of Unicode code point r to the buffer, errors written to stderr
func (*Buffer) WriteString ¶
WriteString to buffer, errors written to stderr
type BufferPool ¶ added in v0.6.21
type BufferPool struct {
// contains filtered or unexported fields
}
func NewBufferPool ¶ added in v0.6.21
func NewBufferPool() *BufferPool
func (*BufferPool) Get ¶ added in v0.6.21
func (bp *BufferPool) Get() *bytes.Buffer
func (*BufferPool) Put ¶ added in v0.6.21
func (bp *BufferPool) Put(buf *bytes.Buffer)
type DataPath ¶ added in v0.6.8
type DataPath string
DataPath string which can be return as substring splitted on / (slash)
func (DataPath) Lookup ¶ added in v0.6.8
Lookup object in path, if data found is of type string it will be quoted with ""
func (DataPath) LookupMulti ¶ added in v0.6.8
LookupMulti objects with subpaths under an array in a path
func (DataPath) LookupNoQuotes ¶ added in v0.6.8
LookupNoQuotes object in path, data of type string will not be quoted
type DistributionSettings ¶
type DistributionSettings struct {
// Type of timer delay
Type DistributionType `json:"type" displayname:"Distribution type" doc-key:"thinktime.type"`
// Delay static delay when using static timer delay
Delay float64 `json:"delay,omitempty" displayname:"Static delay" doc-key:"thinktime.delay"`
// Mean value
Mean float64 `json:"mean,omitempty" displayname:"Mean value" doc-key:"thinktime.mean"`
// Deviation value
Deviation float64 `json:"dev,omitempty" displayname:"Deviation value" doc-key:"thinktime.dev"`
}
DistributionSettings think time settings
func (DistributionSettings) GetActionInfo ¶
func (settings DistributionSettings) GetActionInfo() string
GetActionInfo get information for action details logging
func (DistributionSettings) GetMax ¶
func (settings DistributionSettings) GetMax() (float64, error)
GetMax value
func (DistributionSettings) GetMin ¶
func (settings DistributionSettings) GetMin() (float64, error)
GetMin value
func (DistributionSettings) RandDuration ¶ added in v0.4.11
func (settings DistributionSettings) RandDuration(rnd Randomizer) (time.Duration, error)
RandDuration returns a random duration
func (DistributionSettings) Validate ¶
func (settings DistributionSettings) Validate() ([]string, error)
Validate DistributionSettings
type DistributionType ¶
type DistributionType int
DistributionType type of distribution
const ( // StaticDistribution fixed distribution StaticDistribution DistributionType = iota // UniformDistribution uniform distribution, defined by "mean" and "dev" UniformDistribution )
func (DistributionType) GetEnumMap ¶
func (value DistributionType) GetEnumMap() *enummap.EnumMap
GetEnumMap of DistributionType
func (DistributionType) MarshalJSON ¶
func (value DistributionType) MarshalJSON() ([]byte, error)
MarshalJSON marshal ThinkTime type
func (*DistributionType) UnmarshalJSON ¶
func (value *DistributionType) UnmarshalJSON(arg []byte) error
UnmarshalJSON unmarshal DistributionType
type FuzzyBool ¶ added in v0.17.18
type FuzzyBool bool
FuzzyBool resolves boolean sent as strings, integers, float64 or boolean, json unmarshal defaults to true
func (*FuzzyBool) UnmarshalJSON ¶ added in v0.17.18
UnmarshalJSON FuzzyBool
type FuzzyInt ¶ added in v0.18.2
type FuzzyInt int
FuzzyInt resolves integer sent as string, integer or float64
func (*FuzzyInt) UnmarshalJSON ¶ added in v0.18.2
type NoDataFound ¶ added in v0.6.8
type NoDataFound string
NoDataFound no data found in path
func (NoDataFound) Error ¶ added in v0.6.8
func (err NoDataFound) Error() string
Error no data found in data path
type NoStepsError ¶ added in v0.6.8
type NoStepsError string
NoStepsError no steps to take in data path
func (NoStepsError) Error ¶ added in v0.6.8
func (err NoStepsError) Error() string
Error no steps in data path
type Password ¶ added in v0.15.5
type Password string
Password
func (*Password) MarshalJSON ¶ added in v0.15.5
MarshalJSON marshal password to json: replace with ***
func (*Password) UnmarshalJSON ¶ added in v0.15.5
UnmarshalJSON unmarshal password from json
type Randomizer ¶ added in v0.4.11
type Randomizer interface {
Rand(max int) int
RandWeightedInt(weights []int) (int, error)
RandIntPos(ints []int) (int, int, error)
RandDuration(minDuration, maxDuration time.Duration) (time.Duration, error)
Reset(instance, session uint64, onlyinstanceSeed bool)
RandRune(runes []rune) rune
// Float64 returns, as a float64, a pseudo-random number in the half-open interval [0.0,1.0).
Float64() float64
}
type RowFile ¶
type RowFile struct {
// contains filtered or unexported fields
}
RowFile path to file on disc to read into memory
func NewRowFile ¶
NewRowFile reads rows from file path into memory
func (RowFile) MarshalJSON ¶
MarshalJSON marshal filepath to JSON
func (*RowFile) Rows ¶
Rows in memory from file, to read into memory, either ReadRows or UnmarshalJSON needs to have been called
func (*RowFile) UnmarshalJSON ¶
UnmarshalJSON reads file from filepath into memory
type SyncCounter ¶ added in v0.21.19
type SyncCounter struct {
// contains filtered or unexported fields
}
func (*SyncCounter) Current ¶ added in v0.21.19
func (counter *SyncCounter) Current() int
Current value
func (*SyncCounter) Dec ¶ added in v0.21.19
func (counter *SyncCounter) Dec() int
Dec decrease and return new value
func (*SyncCounter) Inc ¶ added in v0.21.19
func (counter *SyncCounter) Inc() int
Inc increase and return new value
type TimeDuration ¶
func (TimeDuration) MarshalJSON ¶
func (duration TimeDuration) MarshalJSON() ([]byte, error)
MarshalJSON marshal time buffer duration to JSON
func (*TimeDuration) UnmarshalJSON ¶
func (duration *TimeDuration) UnmarshalJSON(arg []byte) error
UnmarshalJSON unmarshal time buffer duration from JSON
type TimerPool ¶ added in v0.21.3
type TimerPool struct {
// contains filtered or unexported fields
}
func NewTimerPool ¶ added in v0.21.3
func NewTimerPool() *TimerPool
type TreatAs ¶
type TreatAs interface {
/*
Supported types:
String
Int
Float
Enum
Bool
Slice
SliceElement
StringMap
StringMapElement
*/
TreatAs() string
}
Implement this interface to override the type a struct is treated as by the GUI
type UniqueInts ¶ added in v0.5.3
type UniqueInts map[int]struct{}
func (*UniqueInts) AddValue ¶ added in v0.5.3
func (u *UniqueInts) AddValue(v int)
AddValue to unique list
func (*UniqueInts) Array ¶ added in v0.5.3
func (u *UniqueInts) Array() []int
Array of unique integers
func (*UniqueInts) HasValue ¶ added in v0.5.3
func (u *UniqueInts) HasValue(v int) bool
HasValue test if collection includes value
type WorkerPool ¶ added in v0.21.19
type WorkerPool struct {
// contains filtered or unexported fields
}
func NewWorkerPool ¶ added in v0.21.19
func NewWorkerPool(concurrency, total int) (*WorkerPool, error)
NewWorkerPool creates channels based on Concurrency and Total tasks. Add tasks with AddTask function, once all tasks has been added, Results can be read from Results(), once Results is closed all tasks are finished Exactly the "total" amount needs to be added or Results will never be closed
func (*WorkerPool) AddTask ¶ added in v0.21.19
func (pool *WorkerPool) AddTask(f func() error) error
AddTask to worker pool (Needs to be exactly the amount of tasks defined by "Total" or pool will never close results)
func (*WorkerPool) Results ¶ added in v0.21.19
func (pool *WorkerPool) Results() <-chan error
Results from tasks, once this channel is closed all tasks are finished