Documentation ¶
Index ¶
- Constants
- Variables
- func GenerateResponse(code int, body string, headers map[string][]string) []byte
- func GenerateTestTraceSummary(sleepDuration time.Duration) *engine.TraceSummary
- func GetRequest(url string) func(string) (*http.Request, error)
- func GetTlsServerAddress() string
- func GetTlsServerUrl() string
- func IsValueInRange(baseVal, refVal interface{}) error
- func RunLocalServer(f func(w http.ResponseWriter, r *http.Request)) *httptest.Server
- func RunTest(t *testing.T, p *httpbench.Preset, benchConfig BenchConfig, ...)
- func WrapTestTimeout(bench BenchConfig, finish <-chan bool) error
- type BenchConfig
- type CombinedTestResult
- type CombinedTestResults
- type HttpBenchType
- type HttpResponseType
- type ServerRequestResult
- type SockIpc
- func (sock *SockIpc) Close()
- func (sock *SockIpc) Connect() error
- func (sock *SockIpc) HandleConnection(conn net.Conn, f func(data []byte))
- func (sock *SockIpc) ListenAndServe(writeOnAccept []byte, recvFunc func(data []byte))
- func (sock *SockIpc) ReadConfig() []byte
- func (sock *SockIpc) SendData(data []byte)
- type TestResults
- type TlsServerCmd
Constants ¶
View Source
const ( ListenPort = 8000 IpV6Localhost = "::1" ServerTimeout = 3 * time.Second CertFile = "utils/localhost.crt" KeyFile = "utils/localhost.key" ServerPath = "tlsserver/tlsserver" // The test could also build the server SockAddr = "/tmp/comm.sock" ReadyString = "ServerIsReady :)" CommunicationSeparator = "\n,,,,\n" ReqDelayAddition = 3 * time.Millisecond BaseDuration = 300 * time.Millisecond BaseReqDelay = 20 * time.Millisecond FailRequestEvery = 4 TlsHandshakeTraceName = "TlsHandshakeDone" FirstByteTraceName = "FirstByte" ReadingBodyTraceName = "ReadingBody" NonSeededRequest = "PreSeeded" )
View Source
const NumberOfTasksToFinish = 2 /* If these two tasks doesn't finish with a reasonable time- we declare test timeout
a. The http bench process
b. The result channel is closed
*/
Variables ¶
View Source
var ( DummySleepTraceSummary = GenerateTestTraceSummary(100 * time.Millisecond) FailInRow = []int64{1, 3} // Not relevant if response fail type is Http200 )
View Source
var TraceHooksServerTypes = map[string]bool{ TlsHandshakeTraceName: true, FirstByteTraceName: true, ReadingBodyTraceName: true, }
Functions ¶
func GenerateResponse ¶
func GenerateTestTraceSummary ¶
func GenerateTestTraceSummary(sleepDuration time.Duration) *engine.TraceSummary
func GetTlsServerAddress ¶
func GetTlsServerAddress() string
func GetTlsServerUrl ¶
func GetTlsServerUrl() string
func IsValueInRange ¶
func IsValueInRange(baseVal, refVal interface{}) error
func RunLocalServer ¶
func RunTest ¶
func RunTest(t *testing.T, p *httpbench.Preset, benchConfig BenchConfig, f func() *httpbench.PresetResult)
func WrapTestTimeout ¶
func WrapTestTimeout(bench BenchConfig, finish <-chan bool) error
Types ¶
type BenchConfig ¶
type BenchConfig struct { MaxConcurrentLimit uint64 `json: MaxConcurrentLimit` SyncedConcurrent uint64 `json: SyncedConcurrent` MaxRequests uint64 `json: MaxRequests` FailsEveryReq uint64 `json: FailsEveryReq` FailsInRow uint64 `json: FailsInRow` ReqDelay time.Duration `json: ReqDelay` Duration time.Duration `json: Duration` DummyTraceSummary *engine.TraceSummary `json: DummyTraceSummary` WaitHook syncedtrace.TraceHookType `json: WaitHook` FailType HttpResponseType `json: FailType` Type HttpBenchType `json: Type` HitsGraph httpbench.HitsGraph `json: HitsGraph` }
func GenerateBenchConfigs ¶
func GenerateBenchConfigs(inputBenches []BenchConfig, inputValues [][]int64) []BenchConfig
func (*BenchConfig) SetPermutation ¶
func (bench *BenchConfig) SetPermutation(permutation []int64)
type CombinedTestResult ¶
type CombinedTestResult struct { TraceResults *engine.TraceResult `json:"bench_result"` ServerResults *ServerRequestResult `json:"server_result"` }
type CombinedTestResults ¶
type CombinedTestResults struct { TraceResults map[string]*engine.TraceResult ServerResults map[string]*ServerRequestResult }
func NewTestResults ¶
func NewTestResults() *CombinedTestResults
type HttpBenchType ¶
type HttpBenchType int
const ( PerDuration HttpBenchType = iota Synced SyncedOnce UnSynced Graph )
type HttpResponseType ¶
type HttpResponseType int
const ( Http200 HttpResponseType = iota //Http300 // No supported for now. raises panic Http400 Http500 HttpRand )
type ServerRequestResult ¶
type ServerRequestResult struct { Hooks map[syncedtrace.TraceHookType]*syncedtrace.Hook `json:"hooks"` UniqueId string `json:"unique_id"` EndTime time.Time `json:"start_time"` BeforeRead time.Time `json:"waited_for_hook"` AggregatedDuration time.Duration `json:"aggregated_duration"` Err string `json:"error"` }
type SockIpc ¶
type SockIpc struct { Closed bool // contains filtered or unexported fields }
func (*SockIpc) HandleConnection ¶
func (*SockIpc) ListenAndServe ¶
func (*SockIpc) ReadConfig ¶
type TestResults ¶
type TestResults struct { T *testing.T Bench *BenchConfig TestResults *CombinedTestResults PresetResult *httpbench.PresetResult // contains filtered or unexported fields }
func (*TestResults) SetupAndRunServer ¶
func (tr *TestResults) SetupAndRunServer(ServReadyChan chan error) (*TlsServerCmd, error)
func (*TestResults) VerifyServerResults ¶
func (tr *TestResults) VerifyServerResults()
func (*TestResults) WaitForAllResults ¶
func (tr *TestResults) WaitForAllResults() (int, int, bool)
type TlsServerCmd ¶
type TlsServerCmd struct { Cmd *exec.Cmd StdoutPipe io.ReadCloser StderrPipe io.ReadCloser // contains filtered or unexported fields }
func (*TlsServerCmd) Done ¶
func (s *TlsServerCmd) Done() <-chan struct{}
func (*TlsServerCmd) Stop ¶
func (s *TlsServerCmd) Stop()
Click to show internal directories.
Click to hide internal directories.