Skip to content

Commit

Permalink
added options tests
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelperel committed Jul 21, 2020
1 parent a7c754b commit 40d44c6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
14 changes: 14 additions & 0 deletions runner/options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,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, uint(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)
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, uint(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 All @@ -114,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)),
Expand All @@ -137,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, uint(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)
Expand Down Expand Up @@ -183,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)),
Expand All @@ -205,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, uint(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 Expand Up @@ -237,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, uint(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 Down Expand Up @@ -266,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, uint(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)
Expand Down Expand Up @@ -300,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, uint(0), c.skipFirst)
assert.Equal(t, 1, c.nConns)
assert.Equal(t, false, c.binary)
assert.Equal(t, time.Duration(0), c.z)
Expand Down Expand Up @@ -336,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, uint(0), c.skipFirst)
assert.Equal(t, 5, c.nConns)
assert.Equal(t, false, c.binary)
assert.Equal(t, time.Duration(0), c.z)
Expand Down Expand Up @@ -381,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, uint(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)
Expand All @@ -399,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, uint(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)
Expand All @@ -417,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, uint(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)
Expand Down
1 change: 1 addition & 0 deletions testdata/config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"total": 5000,
"concurrency": 50,
"skipFirst": 5,
"max-duration": "7s",
"duration": "12s",
"stream-interval": "500ms",
Expand Down
1 change: 1 addition & 0 deletions testdata/config.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down

0 comments on commit 40d44c6

Please sign in to comment.