Skip to content

Commit

Permalink
Add a hint when MaxVUs is more than the total number of iterations
Browse files Browse the repository at this point in the history
Combined with mentions in the readme, docs and CLI help this should be enough to prevent confusion, so we can close #663
  • Loading branch information
na-- committed Oct 10, 2018
1 parent a1fa98d commit c812926
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func optionFlagSet() *pflag.FlagSet {
flags.Int64P("vus", "u", 1, "number of virtual users")
flags.Int64P("max", "m", 0, "max available virtual users")
flags.DurationP("duration", "d", 0, "test duration limit")
flags.Int64P("iterations", "i", 0, "script iteration limit")
flags.Int64P("iterations", "i", 0, "script total iteration limit (among all VUs)")
flags.StringSliceP("stage", "s", nil, "add a `stage`, as `[duration]:[target]`")
flags.BoolP("paused", "p", false, "start the test in a paused state")
flags.Int64("max-redirects", 10, "follow at most n redirects")
Expand Down
7 changes: 7 additions & 0 deletions cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,13 @@ a commandline interface for interacting with it.`,
conf.Iterations = null.IntFrom(1)
}

if conf.Iterations.Valid && conf.Iterations.Int64 < conf.VUsMax.Int64 {
log.Warnf(
"All iterations (%d in this test run) are shared between all VUs, so some of the %d VUs will not execute even a single iteration!",
conf.Iterations.Int64, conf.VUsMax.Int64,
)
}

// If duration is explicitly set to 0, it means run forever.
if conf.Duration.Valid && conf.Duration.Duration == 0 {
conf.Duration = types.NullDuration{}
Expand Down

0 comments on commit c812926

Please sign in to comment.