Documentation ¶
Index ¶
- Constants
- Variables
- func BinaryDiff(a, b []byte) ([]byte, error)
- func Judge(diffs []*DiffRecord) bool
- func ParseGzip(ctx context.Context, data []byte) ([]byte, error)
- func QDEFormat(sid string, isSuccess bool, diffs []*DiffRecord) interface{}
- func ToBinary(text []byte) ([]byte, error)
- func UnzipHttpRepsonse(ctx context.Context, data []byte) []byte
- type CommonItem
- type Composer
- func (c *Composer) DiffAppendFile(ctx context.Context, ajaxs []*DiffRecord, cnt int) []*DiffRecord
- func (c *Composer) DiffInbound(ctx context.Context, ajaxs []*DiffRecord)
- func (c *Composer) DiffOther(ctx context.Context, ajaxs []*DiffRecord, cnt int) []*DiffRecord
- func (c *Composer) DiffOutbounds(ctx context.Context, ajaxs []*DiffRecord, cnt int)
- func (c *Composer) GetMatchedIndex(id int) bool
- func (c *Composer) SetMatchedIndex(id int)
- type Diff
- type DiffItem
- type DiffRecord
- type FailedItem
- type FormatDiff
- type PairItem
- type Session
- type SuccessItem
Constants ¶
View Source
const ( ReqStatusIgnored = "ignored..." ReqStatusNotMatched = "not matched..." ReqStatusMissed = "missed..." LogStatusRepeated = "match repeated" LogStatusMissed = "match missed" )
Variables ¶
View Source
var ( // standard error type HasDiffErr = errors.New("Has Diff") HasDiffButIgnoreErr = errors.New("Has Diff but ignore") // user-defined error type EmptyJsonErr = errors.New("empty json obj") EmptyBodyErr = errors.New("empty test request or response") PublicLogFormatErr = errors.New("malformed public log") PublicLogNotDefinedErr = errors.New("log path not defined") PublicLogKeyNotDefinedErr = errors.New("key not defined") )
Functions ¶
func Judge ¶
func Judge(diffs []*DiffRecord) bool
func QDEFormat ¶
func QDEFormat(sid string, isSuccess bool, diffs []*DiffRecord) interface{}
Types ¶
type CommonItem ¶
type Composer ¶
type Composer struct { // guard MatchedIndex sync.RWMutex // control workflow sync.WaitGroup Project string RequestMark string NoiseInfo map[string]nuwaplt.NoiseInfo MatchedIndex map[int]bool PublogCnt map[string]int Sess *Session }
func (*Composer) DiffAppendFile ¶
func (c *Composer) DiffAppendFile(ctx context.Context, ajaxs []*DiffRecord, cnt int) []*DiffRecord
func (*Composer) DiffInbound ¶
func (c *Composer) DiffInbound(ctx context.Context, ajaxs []*DiffRecord)
func (*Composer) DiffOther ¶
func (c *Composer) DiffOther(ctx context.Context, ajaxs []*DiffRecord, cnt int) []*DiffRecord
func (*Composer) DiffOutbounds ¶
func (c *Composer) DiffOutbounds(ctx context.Context, ajaxs []*DiffRecord, cnt int)
func (*Composer) GetMatchedIndex ¶
func (*Composer) SetMatchedIndex ¶
type Diff ¶
type Diff struct {
A, B string
Noise map[string]nuwaplt.NoiseInfo
CallFromInboundRequestMark string
}
func (*Diff) CompareProtocol ¶
func (d *Diff) CompareProtocol() (compared []*FormatDiff, requestMark string, err error, protocal string)
解析协议并对比,通过打平数组diff
func (*Diff) ParseProtocol ¶
type DiffRecord ¶
type DiffRecord struct { Id int `json:"id"` Project string `json:"project"` RequestMark string `json:"requestMark"` Noise string `json:"noise"` Diff string `json:"diff"` FormatDiff []*FormatDiff `json:"formatDiff"` OnlineReq string `json:"onlineReq"` BinaryOnlineReq string `json:"binaryOnlineReq"` TestReq string `json:"testReq"` BinaryTestReq string `json:"binaryTestReq"` OnlineRes string `json:"onlineRes"` BinaryOnlineRes string `json:"binaryOnlineRes"` TestRes string `json:"testRes"` BinaryTestRes string `json:"binaryTestRes"` MockedRes string `json:"mockedRes"` BinaryMockedRes string `json:"binaryMockedRes"` IsDiff int `json:"isDiff"` Protocol string `json:"protocol"` ScorePercentage string `json:"scorePercentage"` NoWebDisplay bool `json:"noWebDisplay"` }
func DiffReplayed ¶
func DiffReplayed(ctx context.Context, sess *Session, project string) []*DiffRecord
*
- 回放结果进行diff、binary、missing、extend转换 *
- @Return
type FailedItem ¶
type FailedItem struct { CommonItem SessionId string `json:"session_id"` Url string `json:"url"` Diffs []DiffItem `json:"diff"` }
type FormatDiff ¶
type Session ¶
type Session struct { SessionId string Context string Request []byte OnlineResponse []byte TestResponse []byte Outbounds []*replaying.CallOutbound OnlineOutbounds []*recording.CallOutbound OnlineAppendFiles []*recording.AppendFile }
type SuccessItem ¶
type SuccessItem struct { CommonItem SubRequests []string `json:"sub_request"` }
Click to show internal directories.
Click to hide internal directories.