goverrun

package
v0.0.0-...-73c40a8 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2021 License: MIT Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// exported
	AddUserLoopHeader         bool
	AddScenarioStepHeader     bool
	SkipCertificateValidation bool
	Proxy                     string
	UserAgent                 string
)
View Source
var (
	SubcommandReport *flag.FlagSet
	SubcommandRun    *flag.FlagSet
	CommandlineArgs  = &CommandlineArguments{}
)
View Source
var UserAgents = []string{
	"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36",
	"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.2 Safari/605.1.15",
	"Mozilla/5.0 (Android; Linux armv7l; rv:10.0.1) Gecko/20100101 Firefox/10.0.1 Fennec/10.0.1",
	"Mozilla/5.0 (Android; Linux armv7l; rv:2.0.1) Gecko/20100101 Firefox/4.0.1 Fennec/2.0.1",
	"Mozilla/5.0 (WindowsCE 6.0; rv:2.0.1) Gecko/20100101 Firefox/4.0.1",
	"Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20100101 Firefox/5.0",
	"Mozilla/5.0 (Windows NT 5.2; rv:10.0.1) Gecko/20100101 Firefox/10.0.1 SeaMonkey/2.7.1",
	"Mozilla/5.0 (Windows NT 6.0) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.120 Safari/535.2",
	"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/18.6.872.0 Safari/535.2 UNTRUSTED/1.0 3gpp-gba UNTRUSTED/1.0",
	"Mozilla/5.0 (Windows NT 6.1; rv:12.0) Gecko/20120403211507 Firefox/12.0",
	"Mozilla/5.0 (Windows NT 6.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1",
	"Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1",
	"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.27 (KHTML, like Gecko) Chrome/12.0.712.0 Safari/534.27",
	"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.24 Safari/535.1",
	"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.36 Safari/535.7",
	"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.6 (KHTML, like Gecko) Chrome/20.0.1092.0 Safari/536.6",
	"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.1) Gecko/20100101 Firefox/10.0.1",
	"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20120427 Firefox/15.0a1",
	"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b4pre) Gecko/20100815 Minefield/4.0b4pre",
	"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0a2) Gecko/20110622 Firefox/6.0a2",
	"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0.1) Gecko/20100101 Firefox/7.0.1",
	"Mozilla/5.0 (Windows NT 6.2) AppleWebKit/536.3 (KHTML, like Gecko) Chrome/19.0.1061.1 Safari/536.3",
	"Mozilla/5.0 (Windows; U; ; en-NZ) AppleWebKit/527  (KHTML, like Gecko, Safari/419.3) Arora/0.8.0",
	"Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.4) Gecko Netscape/7.1 (ax)",
	"Mozilla/5.0 (Windows; U; Windows CE 5.1; rv:1.8.1a3) Gecko/20060610 Minimo/0.016",
	"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/531.21.8 (KHTML, like Gecko) Version/4.0.4 Safari/531.21.10",
	"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.7 (KHTML, like Gecko) Chrome/7.0.514.0 Safari/534.7",
	"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090825 SeaMonkey/1.1.18",
	"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10",
	"Mozilla/5.0 (Windows; U; Windows NT 5.1; tr; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8 ( .NET CLR 3.5.30729; .NET4.0E)",
	"Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US) AppleWebKit/532.9 (KHTML, like Gecko) Chrome/5.0.310.0 Safari/532.9",
	"Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US) AppleWebKit/533.17.8 (KHTML, like Gecko) Version/5.0.1 Safari/533.17.8",
	"Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.11 (.NET CLR 3.5.30729)",
	"Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/527  (KHTML, like Gecko, Safari/419.3) Arora/0.6 (Change: )",
	"Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/533.1 (KHTML, like Gecko) Maxthon/3.0.8.2 Safari/533.1",
	"Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/534.14 (KHTML, like Gecko) Chrome/9.0.601.0 Safari/534.14",
	"Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6 GTB5",
	"Mozilla/5.0 (Windows; U; Windows NT 6.0 x64; en-US; rv:1.9pre) Gecko/2008072421 Minefield/3.0.2pre",
	"Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.1.17) Gecko/20110123 (like Firefox/3.x) SeaMonkey/2.0.12",
	"Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.0.249.0 Safari/532.5",
	"Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/533.19.4 (KHTML, like Gecko) Version/5.0.2 Safari/533.18.5",
	"Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.14 (KHTML, like Gecko) Chrome/10.0.601.0 Safari/534.14",
	"Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.20 (KHTML, like Gecko) Chrome/11.0.672.2 Safari/534.20",
	"Mozilla/5.0 (Windows; U; Windows XP) Gecko MultiZilla/1.6.1.0a",
	"Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.2b) Gecko/20021001 Phoenix/0.2",
	"Mozilla/5.0 (X11; FreeBSD amd64; rv:5.0) Gecko/20100101 Firefox/5.0",
	"Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.34 (KHTML, like Gecko) QupZilla/1.2.0 Safari/534.34",
	"Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.1 (KHTML, like Gecko) Ubuntu/11.04 Chromium/14.0.825.0 Chrome/14.0.825.0 Safari/535.1",
	"Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.2 (KHTML, like Gecko) Ubuntu/11.10 Chromium/15.0.874.120 Chrome/15.0.874.120 Safari/535.2",
	"Mozilla/5.0 (X11; Linux i686 on x86_64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1",
	"Mozilla/5.0 (X11; Linux i686 on x86_64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1 Fennec/2.0.1",
	"Mozilla/5.0 (X11; Linux i686; rv:10.0.1) Gecko/20100101 Firefox/10.0.1 SeaMonkey/2.7.1",
	"Mozilla/5.0 (X11; Linux i686; rv:12.0) Gecko/20100101 Firefox/12.0 ",
	"Mozilla/5.0 (X11; Linux i686; rv:2.0.1) Gecko/20100101 Firefox/4.0.1",
	"Mozilla/5.0 (X11; Linux i686; rv:2.0b6pre) Gecko/20100907 Firefox/4.0b6pre",
	"Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0",
	"Mozilla/5.0 (X11; Linux i686; rv:6.0a2) Gecko/20110615 Firefox/6.0a2 Iceweasel/6.0a2",
	"Mozilla/5.0 (X11; Linux i686; rv:6.0) Gecko/20100101 Firefox/6.0",
	"Mozilla/5.0 (X11; Linux i686; rv:8.0) Gecko/20100101 Firefox/8.0",
	"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.24 (KHTML, like Gecko) Ubuntu/10.10 Chromium/12.0.703.0 Chrome/12.0.703.0 Safari/534.24",
	"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.20 Safari/535.1",
	"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.9 Safari/536.5",
	"Mozilla/5.0 (X11; Linux x86_64; en-US; rv:2.0b2pre) Gecko/20100712 Minefield/4.0b2pre",
	"Mozilla/5.0 (X11; Linux x86_64; rv:10.0.1) Gecko/20100101 Firefox/10.0.1",
	"Mozilla/5.0 (X11; Linux x86_64; rv:11.0a2) Gecko/20111230 Firefox/11.0a2 Iceweasel/11.0a2",
	"Mozilla/5.0 (X11; Linux x86_64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1",
	"Mozilla/5.0 (X11; Linux x86_64; rv:2.2a1pre) Gecko/20100101 Firefox/4.2a1pre",
	"Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20100101 Firefox/5.0 Iceweasel/5.0",
	"Mozilla/5.0 (X11; Linux x86_64; rv:7.0a1) Gecko/20110623 Firefox/7.0a1",
	"Mozilla/5.0 (X11; U; FreeBSD amd64; en-us) AppleWebKit/531.2  (KHTML, like Gecko) Safari/531.2  Epiphany/2.30.0",
	"Mozilla/5.0 (X11; U; FreeBSD i386; de-CH; rv:1.9.2.8) Gecko/20100729 Firefox/3.6.8",
	"Mozilla/5.0 (X11; U; FreeBSD i386; en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/4.0.207.0 Safari/532.0",
	"Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.6) Gecko/20040406 Galeon/1.3.15",
	"Mozilla/5.0 (X11; U; FreeBSD; i386; en-US; rv:1.7) Gecko",
	"Mozilla/5.0 (X11; U; FreeBSD x86_64; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.204 Safari/534.16",
	"Mozilla/5.0 (X11; U; Linux arm7tdmi; rv:1.8.1.11) Gecko/20071130 Minimo/0.025",
	"Mozilla/5.0 (X11; U; Linux armv61; en-US; rv:1.9.1b2pre) Gecko/20081015 Fennec/1.0a1",
	"Mozilla/5.0 (X11; U; Linux armv6l; rv 1.8.1.5pre) Gecko/20070619 Minimo/0.020",
	"Mozilla/5.0 (X11; U; Linux; en-US) AppleWebKit/527  (KHTML, like Gecko, Safari/419.3) Arora/0.10.1",
	"Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.7.3) Gecko/20040924 Epiphany/1.4.4 (Ubuntu)",
	"Mozilla/5.0 (X11; U; Linux i686; en-us) AppleWebKit/528.5  (KHTML, like Gecko, Safari/528.5 ) lt-GtkLauncher",
	"Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/532.4 (KHTML, like Gecko) Chrome/4.0.237.0 Safari/532.4 Debian",
	"Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/532.8 (KHTML, like Gecko) Chrome/4.0.277.0 Safari/532.8",
}

TODO add more user agent strings to choose from

Functions

func AddRequestInterceptor

func AddRequestInterceptor(fn func(u *User, r *http.Request))

func AddScenario

func AddScenario(scenario *Scenario) error

func CheckErrAndLogError

func CheckErrAndLogError(err error, s string)

func CheckErrAndLogFatal

func CheckErrAndLogFatal(err error, s string)

func CommandlineDefaults

func CommandlineDefaults(users, RampUpSeconds, plateauSeconds, rampDownSeconds int, reportPath string)

func DynamicJSON

func DynamicJSON(jsonBytes []byte) interface{}

func GenerateResultsReport

func GenerateResultsReport(reportPath string) (unmetExpectation bool)

GenerateResultsReport analyzes and prints the loadtest results. All index and step files below the given folder are analyzed. To merge multiple distributed collected results: place them as subfolders below the given folder.

func HeaderSize

func HeaderSize(headerMap map[string][]string) (headerSize int)

func LogDateTime

func LogDateTime(b bool)

func LogDebug

func LogDebug(v ...interface{})

func LogDebugf

func LogDebugf(format string, v ...interface{})

func LogError

func LogError(v ...interface{})

func LogErrorf

func LogErrorf(format string, v ...interface{})

func LogFatal

func LogFatal(v ...interface{})

func LogFatalf

func LogFatalf(format string, v ...interface{})

func LogInfo

func LogInfo(v ...interface{})

func LogInfof

func LogInfof(format string, v ...interface{})

func LogSuccess

func LogSuccess(v ...interface{})

func LogSuccessf

func LogSuccessf(format string, v ...interface{})

func LogWarning

func LogWarning(v ...interface{})

func LogWarningf

func LogWarningf(format string, v ...interface{})

func PrintMissingSubcommandAndExit

func PrintMissingSubcommandAndExit(validCommands ...*flag.FlagSet)

func RandomDuration

func RandomDuration(min, max time.Duration) time.Duration

func RandomElement

func RandomElement(s []string) string

func RandomNumber

func RandomNumber(min, max int) int

func RandomUserAgent

func RandomUserAgent() string

func Reset

func Reset()

func Run

func Run(outputFolder string, verboseLogs bool)

func RunFromCommandlineArgs

func RunFromCommandlineArgs()

func UnwrapDeepestError

func UnwrapDeepestError(currentErr error) string

Types

type AnalyzedResults

type AnalyzedResults struct {
	Stats       ResultStats
	Percentiles ResultPercentiles
	Histogram   ResultHistogram
}

type CommandlineArguments

type CommandlineArguments struct {
	Run struct {
		LoopingUsers, RampUpSeconds, PlateauSeconds, RampDownSeconds *int
		Folder                                                       *string
	}
	Report struct {
		Folder *string
	}
	SubcommandArgs []string
}

type CountExpectation

type CountExpectation struct {
	Count       uint64
	Unmet       bool
	ActualValue uint64
}

type Counts

type Counts struct {
	Requests uint64
	Timeouts uint64
	Failures uint64
	Errors   uint64
}

func (Counts) ErrorPercentage

func (c Counts) ErrorPercentage() float64

func (Counts) FailurePercentage

func (c Counts) FailurePercentage() float64

func (Counts) SuccessPercentage

func (c Counts) SuccessPercentage() float64

func (Counts) Successes

func (c Counts) Successes() uint64

func (Counts) TimeoutPercentage

func (c Counts) TimeoutPercentage() float64

type Environment

type Environment struct {
	Hostname string
	Start    time.Time
}

type Expectation

type Expectation struct {
	SuccessPercentageAtLeast                 *PercentageExpectation
	FailurePercentageAtMost                  *PercentageExpectation
	ErrorPercentageAtMost                    *PercentageExpectation
	TimeoutPercentageAtMost                  *PercentageExpectation
	SuccessCountAtLeast                      *CountExpectation
	FailureCountAtMost                       *CountExpectation
	ErrorCountAtMost                         *CountExpectation
	TimeoutCountAtMost                       *CountExpectation
	TotalRequestResponseTimePercentileLimits []*PercentileExpectation
	TimeToFirstBytePercentileLimits          []*PercentileExpectation
	TimeAfterRequestSentPercentileLimits     []*PercentileExpectation
	TotalRequestBytesWithin                  *RangeExpectation
	TotalResponseBytesWithin                 *RangeExpectation
	StatusCodeThresholds                     []*StatusCodeExpectation
	FailureTypeMatchesThresholds             []*TypeMatchesThreshold
	ErrorTypeMatchesThresholds               []*TypeMatchesThreshold
	TimeoutTypeMatchesThresholds             []*TypeMatchesThreshold
}

type HistogramBucket

type HistogramBucket struct {
	Min, Max float64 // all in nanoseconds
	Count    int
}

type LoadConfig

type LoadConfig struct {
	StartDelay                RandomInterval
	LoopingUsers              int
	LoopDelay                 RandomInterval
	RampUp, Plateau, RampDown time.Duration
	ClearCookieJarOnEveryLoop bool
}

func DefaultLoadConfigFromArgs

func DefaultLoadConfigFromArgs() LoadConfig

type PercentageExpectation

type PercentageExpectation struct {
	Percentage  float64
	Unmet       bool
	ActualValue float64
}

type PercentileExpectation

type PercentileExpectation struct {
	Percentile  float64
	Duration    time.Duration
	Unmet       bool
	ActualValue time.Duration
}

type RandomInterval

type RandomInterval struct {
	Min, Max time.Duration
}

func (RandomInterval) String

func (ri RandomInterval) String() string

type RangeExpectation

type RangeExpectation struct {
	Min, Max    uint64
	Unmet       bool
	ActualValue uint64
}

type Report

type Report struct {
	Environment                   Environment
	ScenariosByClient             map[string]map[string]Scenario
	StepNamesInChronologicalOrder []string
	StatsByStep                   map[string]Stats
	ExampleByStep                 map[string]string
	OverallStats                  Stats
}

type Request

type Request struct {
	Step       *Step
	Method     string
	URL        string
	Disabled   bool
	Raw        bool
	User       *User
	Headers    map[string]string
	Cookies    map[string]string
	FormParams map[string]string
	Timeout    time.Duration
	Body       *io.Reader
	Request    *http.Request
}

func (*Request) SendWithTimeout

func (req *Request) SendWithTimeout(timeout time.Duration) *Response

func (*Request) SendWithoutTimeout

func (req *Request) SendWithoutTimeout() *Response

func (*Request) SetBody

func (req *Request) SetBody(body *io.Reader) *Request

func (*Request) SetCookie

func (req *Request) SetCookie(key, value string) *Request

func (*Request) SetFormParam

func (req *Request) SetFormParam(key, value string) *Request

func (*Request) SetHeader

func (req *Request) SetHeader(key, value string) *Request

type Response

type Response struct {
	Scenario        string
	Step            *Step
	RequestSize     int
	ResponseSize    int
	RequestURL      string
	FinalURL        string
	StatusCode      int
	Status          string
	Timestamps      *Timestamps
	Timeout         error
	Error           error
	AssertionFailed string
	Body            []byte
	// contains filtered or unexported fields
}

func (*Response) ArchiveStats

func (response *Response) ArchiveStats() *Response

func (*Response) Assert

func (response *Response) Assert(fn func(response *Response) (message string, ok bool)) *Response

func (*Response) AssertBodyContains

func (response *Response) AssertBodyContains(s string) *Response

func (*Response) AssertBodyMatches

func (response *Response) AssertBodyMatches(re *regexp.Regexp) *Response

func (*Response) AssertBodySizeAtLeast

func (response *Response) AssertBodySizeAtLeast(bytes int) *Response

func (*Response) AssertBodySizeAtMost

func (response *Response) AssertBodySizeAtMost(bytes int) *Response

func (*Response) AssertStatus

func (response *Response) AssertStatus(status string) *Response

func (*Response) AssertStatusCode

func (response *Response) AssertStatusCode(statusCode int) *Response

func (*Response) ConsideredUnsuccessful

func (response *Response) ConsideredUnsuccessful() bool

func (*Response) EvalExpressionOnJSON

func (response *Response) EvalExpressionOnJSON(expression string) interface{}

func (*Response) ExtractCaptureGroup

func (response *Response) ExtractCaptureGroup(re *regexp.Regexp) string

func (*Response) ExtractSliceFromJSON

func (response *Response) ExtractSliceFromJSON(expression string) (result []string)

func (*Response) ExtractStringFromJSON

func (response *Response) ExtractStringFromJSON(expression string) string

func (*Response) IsFailed

func (response *Response) IsFailed() bool

func (*Response) MarkAsFailed

func (response *Response) MarkAsFailed(message string)

func (*Response) PrintStats

func (response *Response) PrintStats(w io.Writer) *Response

func (*Response) TotalDuration

func (response *Response) TotalDuration() time.Duration

type ResultHistogram

type ResultHistogram struct {
	Buckets []HistogramBucket
}

type ResultPercentiles

type ResultPercentiles struct {
	P80p00, P90p00, P95p00, P99p00, P99p90, P99p99 float64 // all in nanoseconds
}

type ResultStats

type ResultStats struct {
	Minimum, Maximum, Mean, Median, StandardDeviation, FirstQuartile, ThirdQuartile, InterQuartileRange, Midhinge, Trimean float64 // all in nanoseconds
}

type RoundTripperWrapper

type RoundTripperWrapper struct {

	//currentRequest      *http.Request
	UserAgent string
	// contains filtered or unexported fields
}

func NewRoundTripperWrapper

func NewRoundTripperWrapper(skipCertificateValidationForInvalidTestCerts bool, proxy string) *RoundTripperWrapper

func (*RoundTripperWrapper) RoundTrip

func (trans *RoundTripperWrapper) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip wraps http.DefaultTransport.RoundTrip to keep track of the current request.

type Scenario

type Scenario struct {
	Title, Description string
	Runner             func(user *User)
	LoadConfig         LoadConfig
	Ignored            bool
	ExecutionCount     uint64
}

type Stats

type Stats struct {
	Title               string
	HasUnmetExpectation bool

	Counts                                 Counts
	StatusCodes                            map[int]int
	FailureTypes, ErrorTypes, TimeoutTypes map[string]int
	RequestBytes, ResponseBytes            uint64

	TTFB, TARS, TRRT                                                []float64 `json:"-"` // ignore in JSON as instead of raw-data we want the analyzed result data (AnalyzedResults)
	TimeToFirstByte, TimeAfterRequestSent, TotalRequestResponseTime AnalyzedResults
	Expectation                                                     Expectation
}

type StatusCodeExpectation

type StatusCodeExpectation struct {
	IsAtLeast   bool
	StatusCode  int
	Percentage  float64
	Unmet       bool
	ActualValue float64
}

type Step

type Step struct {
	Name        string
	User        *User
	Expectation *Expectation
}

func (*Step) ExpectErrorCountAtMost

func (step *Step) ExpectErrorCountAtMost(count uint64) *Step

ExpectErrorCountAtMost sets the maximum error count which is expected for this step.

When invoked multiple times, only the count when archiving the step's stats for the first time is used (i.e. subsequent invocations post-archive are silently ignored).

func (*Step) ExpectErrorPercentageAtMost

func (step *Step) ExpectErrorPercentageAtMost(percentage float64) *Step

ExpectErrorPercentageAtMost sets the maximum failure percentage level which is expected for this step. Values may range from 0.0 to 100.0 percent.

When invoked multiple times, only the percentage level when archiving the step's stats for the first time is used (i.e. subsequent invocations post-archive are silently ignored).

func (*Step) ExpectErrorTypeMatchesPercentageAtLeast

func (step *Step) ExpectErrorTypeMatchesPercentageAtLeast(re *regexp.Regexp, percentage float64) *Step

ExpectErrorTypeMatchesPercentageAtLeast sets the expectation of the error type count (of the received error types) for the given step to be at least the given value.

When invoked multiple times, only the expectation value when archiving the step's stats for the first time is used (i.e. subsequent invocations post-archive are silently ignored).

func (*Step) ExpectErrorTypeMatchesPercentageAtMost

func (step *Step) ExpectErrorTypeMatchesPercentageAtMost(re *regexp.Regexp, percentage float64) *Step

ExpectErrorTypeMatchesPercentageAtMost sets the expectation of the error type count (of the received error types) for the given step to be at most the given value.

When invoked multiple times, only the expectation value when archiving the step's stats for the first time is used (i.e. subsequent invocations post-archive are silently ignored).

func (*Step) ExpectFailureCountAtMost

func (step *Step) ExpectFailureCountAtMost(count uint64) *Step

ExpectFailureCountAtMost sets the maximum failure count which is expected for this step.

When invoked multiple times, only the count when archiving the step's stats for the first time is used (i.e. subsequent invocations post-archive are silently ignored).

func (*Step) ExpectFailurePercentageAtMost

func (step *Step) ExpectFailurePercentageAtMost(percentage float64) *Step

ExpectFailurePercentageAtMost sets the maximum failure percentage level which is expected for this step. Values may range from 0.0 to 100.0 percent.

When invoked multiple times, only the percentage level when archiving the step's stats for the first time is used (i.e. subsequent invocations post-archive are silently ignored).

func (*Step) ExpectFailureTypeMatchesPercentageAtLeast

func (step *Step) ExpectFailureTypeMatchesPercentageAtLeast(re *regexp.Regexp, percentage float64) *Step

ExpectFailureTypeMatchesPercentageAtLeast sets the expectation of the failure type count (of the received failure types) for the given step to be at least the given value.

When invoked multiple times, only the expectation value when archiving the step's stats for the first time is used (i.e. subsequent invocations post-archive are silently ignored).

func (*Step) ExpectFailureTypeMatchesPercentageAtMost

func (step *Step) ExpectFailureTypeMatchesPercentageAtMost(re *regexp.Regexp, percentage float64) *Step

ExpectFailureTypeMatchesPercentageAtMost sets the expectation of the failure type count (of the received failure types) for the given step to be at most the given value.

When invoked multiple times, only the expectation value when archiving the step's stats for the first time is used (i.e. subsequent invocations post-archive are silently ignored).

func (*Step) ExpectStatusCodePercentageAtLeast

func (step *Step) ExpectStatusCodePercentageAtLeast(statusCode int, percentage float64) *Step

ExpectStatusCodePercentageAtLeast sets the expectation of the status code count (of the received status codes) for the given step to be at least the given value.

When invoked multiple times, only the expectation value when archiving the step's stats for the first time is used (i.e. subsequent invocations post-archive are silently ignored).

func (*Step) ExpectStatusCodePercentageAtMost

func (step *Step) ExpectStatusCodePercentageAtMost(statusCode int, percentage float64) *Step

ExpectStatusCodePercentageAtMost sets the expectation of the status code count (of the received status codes) for the given step to be at most the given value.

When invoked multiple times, only the expectation value when archiving the step's stats for the first time is used (i.e. subsequent invocations post-archive are silently ignored).

func (*Step) ExpectSuccessCountAtLeast

func (step *Step) ExpectSuccessCountAtLeast(count uint64) *Step

ExpectSuccessCountAtLeast sets the minimum success count which is expected for this step.

When invoked multiple times, only the count when archiving the step's stats for the first time is used (i.e. subsequent invocations post-archive are silently ignored).

func (*Step) ExpectSuccessPercentageAtLeast

func (step *Step) ExpectSuccessPercentageAtLeast(percentage float64) *Step

ExpectSuccessPercentageAtLeast sets the minimum success percentage level which is expected for this step. Values may range from 0.0 to 100.0 percent.

When invoked multiple times, only the percentage level when archiving the step's stats for the first time is used (i.e. subsequent invocations post-archive are silently ignored).

func (*Step) ExpectTimeAfterRequestSentPercentileLimit

func (step *Step) ExpectTimeAfterRequestSentPercentileLimit(percentile float64, duration time.Duration) *Step

ExpectTimeAfterRequestSentPercentileLimit sets the expectation of the duration for the given percentile is within the given maximum duration. Percent values may range from 0.0 to 100.0 percent.

When invoked multiple times, only the percentile expectation value when archiving the step's stats for the first time is used (i.e. subsequent invocations post-archive are silently ignored).

func (*Step) ExpectTimeToFirstBytePercentileLimit

func (step *Step) ExpectTimeToFirstBytePercentileLimit(percentile float64, duration time.Duration) *Step

ExpectTimeToFirstBytePercentileLimit sets the expectation of the duration for the given percentile is within the given maximum duration. Percent values may range from 0.0 to 100.0 percent.

When invoked multiple times, only the percentile expectation value when archiving the step's stats for the first time is used (i.e. subsequent invocations post-archive are silently ignored).

func (*Step) ExpectTimeoutCountAtMost

func (step *Step) ExpectTimeoutCountAtMost(count uint64) *Step

ExpectTimeoutCountAtMost sets the maximum timeout count which is expected for this step.

When invoked multiple times, only the count when archiving the step's stats for the first time is used (i.e. subsequent invocations post-archive are silently ignored).

func (*Step) ExpectTimeoutPercentageAtMost

func (step *Step) ExpectTimeoutPercentageAtMost(percentage float64) *Step

ExpectTimeoutPercentageAtMost sets the maximum failure percentage level which is expected for this step. Values may range from 0.0 to 100.0 percent.

When invoked multiple times, only the percentage level when archiving the step's stats for the first time is used (i.e. subsequent invocations post-archive are silently ignored).

func (*Step) ExpectTimeoutTypeMatchesPercentageAtLeast

func (step *Step) ExpectTimeoutTypeMatchesPercentageAtLeast(re *regexp.Regexp, percentage float64) *Step

ExpectTimeoutTypeMatchesPercentageAtLeast sets the expectation of the timeout type count (of the received timeout types) for the given step to be at least the given value.

When invoked multiple times, only the expectation value when archiving the step's stats for the first time is used (i.e. subsequent invocations post-archive are silently ignored).

func (*Step) ExpectTimeoutTypeMatchesPercentageAtMost

func (step *Step) ExpectTimeoutTypeMatchesPercentageAtMost(re *regexp.Regexp, percentage float64) *Step

ExpectTimeoutTypeMatchesPercentageAtMost sets the expectation of the timeout type count (of the received timeout types) for the given step to be at most the given value.

When invoked multiple times, only the expectation value when archiving the step's stats for the first time is used (i.e. subsequent invocations post-archive are silently ignored).

func (*Step) ExpectTotalRequestBytesWithin

func (step *Step) ExpectTotalRequestBytesWithin(min, max uint64) *Step

ExpectTotalRequestBytesWithin sets the expectation of the total request byte count for the given step.

When invoked multiple times, only the expectation value when archiving the step's stats for the first time is used (i.e. subsequent invocations post-archive are silently ignored).

func (*Step) ExpectTotalRequestResponseTimePercentileLimit

func (step *Step) ExpectTotalRequestResponseTimePercentileLimit(percentile float64, duration time.Duration) *Step

ExpectTotalRequestResponseTimePercentileLimit sets the expectation of the duration for the given percentile is within the given maximum duration. Percent values may range from 0.0 to 100.0 percent.

When invoked multiple times, only the percentile expectation value when archiving the step's stats for the first time is used (i.e. subsequent invocations post-archive are silently ignored).

func (*Step) ExpectTotalResponseBytesWithin

func (step *Step) ExpectTotalResponseBytesWithin(min, max uint64) *Step

ExpectTotalResponseBytesWithin sets the expectation of the total request byte count for the given step.

When invoked multiple times, only the expectation value when archiving the step's stats for the first time is used (i.e. subsequent invocations post-archive are silently ignored).

func (*Step) Request

func (step *Step) Request(method, url string) *Request

func (*Step) RequestRaw

func (step *Step) RequestRaw(targetURL string, buf *bufio.Reader) *Request

NOTE: You (caller) need to set Content-Length explicitly in raw request input correctly AND don't set Accept-Encoding header, so that it will automatically added by transport and then automatically decompressed: see https://stackoverflow.com/questions/13130341/reading-gzipped-http-response-in-go

func (*Step) RequestRawFromFile

func (step *Step) RequestRawFromFile(targetURL string, filename string) *Request

type StepEntry

type StepEntry struct {
	Scenario                 string
	Timestamps               Timestamps
	Timeout                  bool
	TimeoutRootCause         string
	Error                    bool
	ErrorRootCause           string
	AssertionFailed          bool
	AssertionFailedRootCause string
	StatusCode               int
	RequestSize              int
	ResponseSize             int
}

type Timestamps

type Timestamps struct {
	Start                time.Time
	WroteRequest         time.Time
	GotFirstResponseByte time.Time
	Done                 time.Time
}

func (*Timestamps) TimeToFirstByte

func (stats *Timestamps) TimeToFirstByte(afterRequestSent bool) (d time.Duration, completed bool)

func (*Timestamps) TotalDuration

func (stats *Timestamps) TotalDuration() (d time.Duration, completed bool)

type TypeMatchesThreshold

type TypeMatchesThreshold struct {
	IsAtLeast   bool
	RegExp      string
	Percentage  float64
	Unmet       bool
	ActualValue float64
}

type User

type User struct {
	Scenario                 string
	CurrentUser, CurrentLoop int
	HttpClient               *http.Client
	Disabled                 bool
	Data                     map[string]interface{} // intended to set custom values
}

func (*User) Step

func (user *User) Step(name string) *Step

func (*User) ThinkTime

func (user *User) ThinkTime(d time.Duration) *User

func (*User) ThinkTimeRandom

func (user *User) ThinkTimeRandom(min, max time.Duration) *User

Jump to

Keyboard shortcuts

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