feat: support api layer and global headers for testcase

This commit is contained in:
xucong053
2022-03-15 12:39:41 +08:00
parent 3b9e6cd736
commit af6c433069
37 changed files with 907 additions and 135 deletions

View File

@@ -16,6 +16,9 @@ type Boomer struct {
memoryProfile string
memoryProfileDuration time.Duration
disableKeepalive bool
disableCompression bool
}
// NewStandaloneBoomer returns a new Boomer, which can run without master.
@@ -52,6 +55,24 @@ func (b *Boomer) SetRateLimiter(maxRPS int64, requestIncreaseRate string) {
}
}
// SetDisableKeepAlive disable keep-alive for tcp
func (b *Boomer) SetDisableKeepAlive(disableKeepalive bool) {
b.disableKeepalive = disableKeepalive
}
// SetDisableCompression disable compression to prevent the Transport from requesting compression with an "Accept-Encoding: gzip"
func (b *Boomer) SetDisableCompression(disableCompression bool) {
b.disableCompression = disableCompression
}
func (b *Boomer) GetDisableKeepAlive() bool {
return b.disableKeepalive
}
func (b *Boomer) GetDisableCompression() bool {
return b.disableCompression
}
// SetLoopCount set loop count for test.
func (b *Boomer) SetLoopCount(loopCount int64) {
b.localRunner.loop = &Loop{loopCount: loopCount}

View File

@@ -255,6 +255,10 @@ func deserializeStatsEntry(stat interface{}) (entryOutput *statsEntryOutput, err
var duration float64
if entry.Name == "Total" {
duration = float64(entry.LastRequestTimestamp - entry.StartTime)
// fix: avoid divide by zero
if duration < 1 {
duration = 1
}
} else {
duration = float64(reportStatsInterval / time.Second)
}