diff --git a/runner/options_test.go b/runner/options_test.go index ae73b166..b467ed6b 100644 --- a/runner/options_test.go +++ b/runner/options_test.go @@ -91,7 +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, 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) @@ -117,6 +117,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)), @@ -140,6 +141,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, 5, c.skipFirst) assert.Equal(t, true, c.binary) assert.Equal(t, time.Duration(5*time.Minute), c.z) assert.Equal(t, time.Duration(60*time.Second), c.keepaliveTime) @@ -186,6 +188,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)), @@ -208,6 +211,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, 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) @@ -240,6 +244,7 @@ func TestRunConfig_newRunConfig(t *testing.T) { assert.Equal(t, 200, c.n) assert.Equal(t, 50, c.c) assert.Equal(t, 0, c.qps) + 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) @@ -269,6 +274,7 @@ func TestRunConfig_newRunConfig(t *testing.T) { assert.Equal(t, 200, c.n) assert.Equal(t, 50, c.c) assert.Equal(t, 0, c.qps) + assert.Equal(t, 0, c.skipFirst) assert.Equal(t, false, c.binary) assert.Equal(t, time.Duration(0), c.z) assert.Equal(t, time.Duration(0), c.keepaliveTime) @@ -303,6 +309,7 @@ func TestRunConfig_newRunConfig(t *testing.T) { assert.Equal(t, 200, c.n) assert.Equal(t, 50, c.c) assert.Equal(t, 0, c.qps) + assert.Equal(t, 0, c.skipFirst) assert.Equal(t, 1, c.nConns) assert.Equal(t, false, c.binary) assert.Equal(t, time.Duration(0), c.z) @@ -339,6 +346,7 @@ func TestRunConfig_newRunConfig(t *testing.T) { assert.Equal(t, 200, c.n) assert.Equal(t, 50, c.c) assert.Equal(t, 0, c.qps) + assert.Equal(t, 0, c.skipFirst) assert.Equal(t, 5, c.nConns) assert.Equal(t, false, c.binary) assert.Equal(t, time.Duration(0), c.z) @@ -384,6 +392,7 @@ func TestRunConfig_newRunConfig(t *testing.T) { assert.Equal(t, []string{"../../testdata", "."}, c.importPaths) assert.Equal(t, 5000, c.n) assert.Equal(t, 50, c.c) + assert.Equal(t, 5, c.skipFirst) assert.Equal(t, 12*time.Second, c.z) assert.Equal(t, 500*time.Millisecond, c.streamInterval) assert.Equal(t, []byte(`{"name":"Bob {{.TimestampUnix}}"}`), c.data) @@ -402,6 +411,7 @@ func TestRunConfig_newRunConfig(t *testing.T) { assert.Equal(t, []string{"../../testdata", "."}, c.importPaths) assert.Equal(t, 5000, c.n) assert.Equal(t, 50, c.c) + assert.Equal(t, 5, c.skipFirst) assert.Equal(t, 12*time.Second, c.z) assert.Equal(t, 500*time.Millisecond, c.streamInterval) assert.Equal(t, []byte(`{"name":"Bob {{.TimestampUnix}}"}`), c.data) @@ -420,6 +430,7 @@ func TestRunConfig_newRunConfig(t *testing.T) { assert.Equal(t, []string{"../../testdata", "."}, c.importPaths) assert.Equal(t, 5000, c.n) assert.Equal(t, 50, c.c) + assert.Equal(t, 5, c.skipFirst) assert.Equal(t, 12*time.Second, c.z) assert.Equal(t, 500*time.Millisecond, c.streamInterval) assert.Equal(t, []byte(`{"name":"Bob {{.TimestampUnix}}"}`), c.data) diff --git a/runner/reporter.go b/runner/reporter.go index cdaa76de..ed166af5 100644 --- a/runner/reporter.go +++ b/runner/reporter.go @@ -134,10 +134,10 @@ func newReporter(results chan *callResult, c *RunConfig) *Reporter { // Run runs the reporter func (r *Reporter) Run() { - var skipCount uint + var skipCount int for res := range r.results { - if skipCount < uint(r.config.skipFirst) { + if skipCount < r.config.skipFirst { skipCount++ continue } diff --git a/testdata/config.json b/testdata/config.json index ccb166c9..00d6e79b 100644 --- a/testdata/config.json +++ b/testdata/config.json @@ -1,6 +1,7 @@ { "total": 5000, "concurrency": 50, + "skipFirst": 5, "max-duration": "7s", "duration": "12s", "stream-interval": "500ms", diff --git a/testdata/config.toml b/testdata/config.toml index 6d8a04be..f0e2580d 100644 --- a/testdata/config.toml +++ b/testdata/config.toml @@ -1,6 +1,7 @@ "max-duration" = "7s" total = 5000 concurrency = 50 +skipFirst = 5 proto = "../../testdata/greeter.proto" call = "helloworld.Greeter.SayHello" host = "0.0.0.0:50051" diff --git a/www/docs/options.md b/www/docs/options.md index 4da83101..45842f09 100644 --- a/www/docs/options.md +++ b/www/docs/options.md @@ -220,4 +220,4 @@ Enable gzip compression on requests. ### '--skipFirst' -Skip the first n responses from the report. Helps remove initial warm-up requests from skewing the results. \ No newline at end of file +Skip the first n responses from the report. Helps remove initial warm-up requests from skewing the results.