stress

package
v1.0.39 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultURL         = "http://localhost"
	DefaultTimeout     = "10s"
	DefaultMethod      = "GET"
	DefaultUserAgent   = "stress"
	DefaultCount       = 10
	DefaultConcurrency = 1
)

Reasonable default values for a target

Variables

This section is empty.

Functions

func CreateTextStressSummary added in v1.0.3

func CreateTextStressSummary(reqStatSummary RequestStatSummary) string

CreateTextStressSummary creates a human friendly summary of entire stress test

func InitCmd added in v1.0.3

func InitCmd(watchCmd *cobra.Command)

func RunStress added in v1.0.3

func RunStress(s StressConfig, w io.Writer) ([][]RequestStat, error)

RunStress starts the stress tests with the provided StressConfig. Throughout the test, data is sent to w, useful for live updates.

Types

type RequestStat added in v1.0.3

type RequestStat struct {
	StartTime       time.Time `json:"startTime"`
	EndTime         time.Time `json:"endTime"`
	Error           error     `json:"error"`
	Proto           string
	Method          string
	URL             string
	Duration        time.Duration `json:"duration"`
	StatusCode      int           `json:"statusCode"`
	DataTransferred int
}

RequestStat is the saved information about an individual completed HTTP request

type RequestStatSummary added in v1.0.3

type RequestStatSummary struct {
	// contains filtered or unexported fields
}

RequestStatSummary is an aggregate statistical summary of a set of RequestStats

func CreateRequestsStats added in v1.0.3

func CreateRequestsStats(requestStats []RequestStat) RequestStatSummary

CreateRequestsStats creates a statistical summary out of the individual RequestStats

type StressConfig added in v1.0.3

type StressConfig struct {
	Cookies         string
	BasicAuth       string
	Body            string
	BodyFilename    string
	Headers         string
	UserAgent       string
	Timeout         string
	Method          string
	Targets         []Target
	Count           int
	Concurrency     int
	Verbose         bool
	DNSPrefetch     bool
	Quiet           bool
	Compress        bool
	KeepAlive       bool
	FollowRedirects bool
	NoHTTP2         bool
	EnforceSSL      bool
}

StressConfig is the top level struct that contains the configuration for a stress test

func NewStressConfig added in v1.0.3

func NewStressConfig() (s *StressConfig)

NewStressConfig creates a new StressConfig with package defaults

type Target added in v1.0.3

type Target struct {
	Cookies         string
	BasicAuth       string
	UserAgent       string
	Timeout         string
	Method          string
	Body            string
	BodyFilename    string
	Headers         string
	URL             string
	DNSPrefetch     bool
	RegexURL        bool
	Compress        bool
	KeepAlive       bool
	FollowRedirects bool
	NoHTTP2         bool
	EnforceSSL      bool
}

Target is location of where send the HTTP request and how to send it.

Jump to

Keyboard shortcuts

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