Skip to content

Commit

Permalink
Added options test and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Sujit D'Mello committed Jul 20, 2020
1 parent 29532c1 commit 63c4738
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
4 changes: 2 additions & 2 deletions runner/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ type RunConfig struct {
name string
cpus int
tags []byte
skipFirst uint
skipFirst int
}

// Option controls some aspect of run
Expand Down Expand Up @@ -455,7 +455,7 @@ func WithCPUs(c uint) Option {
func WithSkipFirst(c uint) Option {
return func(o *RunConfig) error {
if c > 0 {
o.skipFirst = uint(c)
o.skipFirst = int(c)
}

return nil
Expand Down
3 changes: 3 additions & 0 deletions runner/options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func TestRunConfig_newRunConfig(t *testing.T) {
assert.Equal(t, 50, c.c)
assert.Equal(t, 0, c.qps)
assert.Equal(t, false, c.binary)
assert.Equal(t, 0, c.skipFirst)
assert.Equal(t, time.Duration(0), c.z)
assert.Equal(t, time.Duration(0), c.keepaliveTime)
assert.Equal(t, time.Duration(20*time.Second), c.timeout)
Expand All @@ -70,6 +71,7 @@ func TestRunConfig_newRunConfig(t *testing.T) {
WithTotalRequests(100),
WithConcurrency(20),
WithQPS(5),
WithSkipFirst(5),
WithRunDuration(time.Duration(5*time.Minute)),
WithKeepalive(time.Duration(60*time.Second)),
WithTimeout(time.Duration(10*time.Second)),
Expand All @@ -89,6 +91,7 @@ func TestRunConfig_newRunConfig(t *testing.T) {
assert.Equal(t, 100, c.n)
assert.Equal(t, 20, c.c)
assert.Equal(t, 5, c.qps)
assert.Equal(t, int(5), c.skipFirst)
assert.Equal(t, false, c.binary)
assert.Equal(t, time.Duration(5*time.Minute), c.z)
assert.Equal(t, time.Duration(60*time.Second), c.keepaliveTime)
Expand Down
4 changes: 2 additions & 2 deletions runner/reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func (r *Reporter) Run() {
var skipCount uint

for res := range r.results {
if skipCount < r.config.skipFirst {
if skipCount < uint(r.config.skipFirst) {
skipCount++
continue
}
Expand Down Expand Up @@ -185,7 +185,7 @@ func (r *Reporter) Finalize(stopReason StopReason, total time.Duration) *Report
Key: r.config.key,
CName: r.config.cname,
SkipTLS: r.config.skipVerify,
SkipFirst: r.config.skipFirst,
SkipFirst: uint(r.config.skipFirst),
Insecure: r.config.insecure,
Authority: r.config.authority,
Total: uint(r.config.n),
Expand Down
6 changes: 5 additions & 1 deletion www/docs/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,4 +216,8 @@ Show context-sensitive help (also try --help-long and --help-man).

### `-e`, `--enable-compression`

Enable gzip compression on requests.
Enable gzip compression on requests.

### '--skipFirst'

Skip the first n responses from the report. Helps remove initial warm-up requests from skewing the results.
1 change: 1 addition & 0 deletions www/docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Flags:
--name= User specified name for the test.
--tags= JSON representation of user-defined string tags.
--cpus=12 Number of cpu cores to use.
--skipFirst=0 Skip the first n responses from the report. Helps remove initial warm-up requests from skewing the results.
--debug= The path to debug log file.
-e, --enable-compression Enable Gzip compression on requests.
-v, --version Show application version.
Expand Down

0 comments on commit 63c4738

Please sign in to comment.