Documentation
¶
Index ¶
- Constants
- func UnserializeTDigest(nodes []TDNode) *tdigest.TDigest
- type CallMonitor
- type CallTimeMapKey
- type CallTimeMetric
- type CaseBaseInfo
- type CaseGenFunc
- type CaseParams
- type CaseRunner
- type CaseRunnerInfo
- type CaseSummary
- type HTTPClient
- type IResultV1
- type Output
- type ResponseBody
- type Result
- func (r *Result) AddSub(name string, useNamePrefix bool) *Result
- func (r *Result) Begin()
- func (r *Result) End()
- func (r *Result) GetBeginTime() int64
- func (r *Result) GetEndTime() int64
- func (r *Result) GetFailureMessage() string
- func (r *Result) GetMethod() string
- func (r *Result) GetName() string
- func (r *Result) GetReceivedBytes() int
- func (r *Result) GetRequestBody() string
- func (r *Result) GetRequestHeader() map[string]string
- func (r *Result) GetResponseBody() string
- func (r *Result) GetResponseCode() int
- func (r *Result) GetResponseHeader() map[string]string
- func (r *Result) GetSentBytes() int
- func (r *Result) GetSubResults() []interface{}
- func (r *Result) GetUrl() string
- func (r *Result) IsSuccess() bool
- type RpsQLimiter
- type RspWorkerPushStatus
- type RspWorkerPushStatusBody
- type TDNode
- type TestCase
- type TestCaseInfo
- type TestCaseSummary
- type TestStep
- type Worker
- type WorkerBaseInfo
- type WorkerPushStatusParams
- type WorkerRunner
Constants ¶
View Source
const ( InnerVarName = "__name" InnerVarGoroutineId = "__goroutine_id" InnerVarExecutorIndex = "__executor_index" InnerVarWorkerTotal = "__worker_total" InnerVarWorkerIndex = "__worker_index" InnerVarWorkerConcurrency = "__worker_concurrency" )
Variables ¶
This section is empty.
Functions ¶
func UnserializeTDigest ¶
Types ¶
type CallMonitor ¶
type CallMonitor struct {
TotalCount uint64 `json:"totalCount"`
TotalRt uint64 `json:"totalRt"` // unit: millisecond
MaxRt uint64 `json:"maxRt"`
MinRt uint64 `json:"minRt"`
SuccCount uint64 `json:"succCount"`
FailCount uint64 `json:"failCount"`
BeginTime uint64 `json:"beginTime"`
LastTime uint64 `json:"lastTime"`
}
type CallTimeMapKey ¶
type CallTimeMapKey struct {
TaskId string `json:"taskId"`
MetricName string `json:"metricName"`
IsWholeCase bool `json:"isWholeCase"`
WorkerName string `json:"workerName"`
CaseName string `json:"caseName"`
StepName string `json:"stepName"`
Success bool `json:"success"`
StatusCode int `json:"statusCode"`
Ts int `json:"ts"`
}
type CallTimeMetric ¶
type CallTimeMetric struct {
Key CallTimeMapKey `json:"key"`
Value []TDNode `json:"value"`
}
type CaseBaseInfo ¶
type CaseBaseInfo struct {
Name string `json:"name" binding:"required"`
GlobalParams map[string]string `json:"globalParams" binding:"required"`
TotalMaxConcurrency uint64 `json:"totalMaxConcurrency" binding:"required"`
RampingSeconds uint64 `json:"rampingSeconds" binding:"required"`
DurationMinutes uint64 `json:"durationMinutes" binding:"required"`
WorkName string `json:"workName" binding:"required"`
WorkerConcurrency uint64 `json:"workerConcurrency" binding:"required"`
TaskId string `json:"taskId"`
}
type CaseGenFunc ¶
type CaseGenFunc func(caseRunnerInfo CaseRunnerInfo) *TestCase
type CaseParams ¶ added in v0.0.3
type CaseParams struct {
GlobalParams map[string]string
CoroutineParams map[string]string
CaseRunnerInfo CaseRunnerInfo
}
type CaseRunner ¶
type CaseRunner struct {
Info CaseRunnerInfo
TestCase *TestCase
GlobalParams map[string]string
IsRunning bool
Output *Output
MetricsChan chan ([]*CallTimeMetric)
ActiveConcurrencyCount int64
CoordinatorApi string
// contains filtered or unexported fields
}
func (*CaseRunner) HandleOuput ¶
func (cr *CaseRunner) HandleOuput()
func (*CaseRunner) Run ¶
func (cr *CaseRunner) Run()
func (*CaseRunner) SendMetrics ¶
func (cr *CaseRunner) SendMetrics()
func (*CaseRunner) SetGlobalParams ¶
func (cr *CaseRunner) SetGlobalParams(globalParams map[string]string)
func (*CaseRunner) StopRunChannel ¶
func (cr *CaseRunner) StopRunChannel()
type CaseRunnerInfo ¶
type CaseSummary ¶
type CaseSummary struct {
CallMonitors map[string]*CallMonitor `json:"callMonitor" binding:"optional"`
LastConcurrencyCount uint64 `json:"lastConcurrencyCount"`
}
type HTTPClient ¶
type HTTPClient struct {
// contains filtered or unexported fields
}
func NewHTTPClient ¶
func NewHTTPClient(timeout time.Duration) *HTTPClient
func (*HTTPClient) PostJSON ¶
func (c *HTTPClient) PostJSON(url string, requestBody interface{}, responseBody interface{}) error
type IResultV1 ¶
type IResultV1 interface {
GetName() string
GetUrl() string
GetMethod() string
GetRequestHeader() map[string]string
GetRequestBody() string
GetSentBytes() int
GetResponseCode() int
GetResponseHeader() map[string]string
GetResponseBody() string
GetReceivedBytes() int
GetFailureMessage() string
IsSuccess() bool
GetBeginTime() int64
GetEndTime() int64
GetSubResults() []interface{}
}
type ResponseBody ¶
type Result ¶
type Result struct {
Name string
Url string
Method string
RequestHeader map[string]string
RequestBody string
SentBytes int
ResponseCode int
ResponseHeader map[string]string
ResponseBody string
ReceivedBytes int
FailureMessage string
Success bool
BeginTime int64
EndTime int64
SubResults []interface{}
// contains filtered or unexported fields
}
func AcquireResult ¶
func (*Result) Begin ¶
func (r *Result) Begin()
begin records begin time, do not forget call this function to update
func (*Result) GetBeginTime ¶
func (*Result) GetEndTime ¶
func (*Result) GetFailureMessage ¶
func (*Result) GetReceivedBytes ¶
func (*Result) GetRequestBody ¶
func (*Result) GetRequestHeader ¶
func (*Result) GetResponseBody ¶
func (*Result) GetResponseCode ¶
func (*Result) GetResponseHeader ¶
func (*Result) GetSentBytes ¶
func (*Result) GetSubResults ¶
func (r *Result) GetSubResults() []interface{}
type RpsQLimiter ¶
type RpsQLimiter struct {
Lock sync.Mutex
Limter *ratelimiter.AttributeBasedLimiter
QMap map[string]*queue.Queue
}
type RspWorkerPushStatus ¶
type RspWorkerPushStatus struct {
Worker *Worker `json:"worker"`
ShouldRunCase bool `json:"shouldRunCase"`
ShouldStopCase bool `json:"shouldStopCase"`
TestCaseInfo *TestCaseInfo `json:"testCase"`
}
type RspWorkerPushStatusBody ¶
type RspWorkerPushStatusBody struct {
Code int `json:"code"`
Data *RspWorkerPushStatus `json:"data"`
Msg string `json:"msg"`
}
type TDNode ¶
func SerializeTDigest ¶
type TestCase ¶
type TestCase struct {
Name string
Teststeps []*TestStep
TearDown func(coroutineParams map[string]string)
}
func NewTestCase ¶
func (*TestCase) Run ¶
func (tc *TestCase) Run(globalParams, coroutineParams map[string]string, rpsQLimiter *RpsQLimiter, output *Output, caseRunner *CaseRunner)
type TestCaseInfo ¶
type TestCaseInfo struct {
BaseInfo *CaseBaseInfo `json:"baseInfo"`
WorkerTotal uint64 `json:"workerTotal" binding:"optional"`
RunningWorkerCount uint64 `json:"runningWorkerCount" binding:"optional"`
RuningWorkerIds []string `json:"runningWorkerIds"`
Status string `json:"status" binding:"optional"`
BeginTime uint64 `json:"beginTime"`
LastTime uint64 `json:"lastTime"`
Summary *CaseSummary `json:"summary" binding:"optional"`
}
type TestCaseSummary ¶
type TestStep ¶
type TestStep struct {
StepName string
ReqPluginFunc func(reqPamrams map[string]string) (res IResultV1)
GenReqParamsFunc func(caseParams *CaseParams) (p map[string]string)
ContinueWhenFailed bool
ExecWhenFunc func(caseParams *CaseParams, reqPamrams map[string]string) (b bool)
PreFunc func(caseParams *CaseParams, reqPamrams map[string]string)
PostFunc func(caseParams *CaseParams, reqPamrams map[string]string, res IResultV1)
RpsLimitFunc func(caseRunnerInfo CaseRunnerInfo, globalParams map[string]string) (rps uint64)
// contains filtered or unexported fields
}
func (*TestStep) GetStepIndex ¶ added in v0.0.3
type Worker ¶
type Worker struct {
BaseInfo *WorkerBaseInfo `json:"baseInfo" binding:"required"`
LastAciveAt int64 `json:"lastAciveAt"`
}
type WorkerBaseInfo ¶
type WorkerBaseInfo struct {
Name string `json:"name" binding:"required"`
ID string `json:"id" binding:"required"`
Index int64 `json:"index"`
Status string `json:"status" binding:"required"`
TestCases []*TestCaseSummary `json:"testCases"`
}
type WorkerPushStatusParams ¶
type WorkerPushStatusParams struct {
BaseInfo *WorkerBaseInfo `json:"baseInfo" binding:"required"`
}
type WorkerRunner ¶
type WorkerRunner struct {
Worker *Worker
CoordinatorApi string
CaseMaps map[string]*TestCase
RunningCaseRunner *CaseRunner
// contains filtered or unexported fields
}
func NewWorkerRunner ¶
func NewWorkerRunner(workerName, coordinatorApi string) *WorkerRunner
func (*WorkerRunner) AddTestCase ¶
func (rw *WorkerRunner) AddTestCase(tc *TestCase)
func (*WorkerRunner) PushStatus ¶
func (rw *WorkerRunner) PushStatus() (rwps *RspWorkerPushStatus)
func (*WorkerRunner) RealRun ¶
func (rw *WorkerRunner) RealRun()
func (*WorkerRunner) Run ¶
func (rw *WorkerRunner) Run()
Click to show internal directories.
Click to hide internal directories.