feat: support websocket protocol

This commit is contained in:
buyuxiang
2022-04-21 20:53:11 +08:00
parent d4c95569f6
commit c20969f437
18 changed files with 1205 additions and 36 deletions
+9
View File
@@ -25,6 +25,7 @@ type TConfig struct {
Parameters map[string]interface{} `json:"parameters,omitempty" yaml:"parameters,omitempty"`
ParametersSetting *TParamsConfig `json:"parameters_setting,omitempty" yaml:"parameters_setting,omitempty"`
ThinkTimeSetting *ThinkTimeConfig `json:"think_time,omitempty" yaml:"think_time,omitempty"`
WebSocketSetting *WebSocketConfig `json:"websocket,omitempty" yaml:"websocket,omitempty"`
Export []string `json:"export,omitempty" yaml:"export,omitempty"`
Weight int `json:"weight,omitempty" yaml:"weight,omitempty"`
Path string `json:"path,omitempty" yaml:"path,omitempty"` // testcase file path
@@ -78,6 +79,14 @@ func (c *TConfig) SetWeight(weight int) *TConfig {
return c
}
func (c *TConfig) SetWebSocket(times, interval, timeout, size int64) {
c.WebSocketSetting = &WebSocketConfig{
ReconnectionTimes: times,
ReconnectionInterval: interval,
MaxMessageSize: size,
}
}
type ThinkTimeConfig struct {
Strategy thinkTimeStrategy `json:"strategy,omitempty" yaml:"strategy,omitempty"` // default、random、limit、multiply、ignore
Setting interface{} `json:"setting,omitempty" yaml:"setting,omitempty"` // random(map): {"min_percentage": 0.5, "max_percentage": 1.5}; 10、multiply(float64): 1.5