Skip to content

Commit

Permalink
Added check for negative resourceRate.
Browse files Browse the repository at this point in the history
Added check in build() for invalid combinations of rampUpPeriod and resourceRate.

Signed-off-by: Simone Bordet <[email protected]>
  • Loading branch information
sbordet committed May 3, 2021
1 parent 19de0f2 commit f7a99a3
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1067,6 +1067,9 @@ public Builder channelsPerUser(int channelsPerUser) {
* @return this Builder
*/
public Builder resourceRate(int resourceRate) {
if (resourceRate < 0) {
throw new IllegalArgumentException();
}
this.resourceRate = resourceRate;
return this;
}
Expand Down Expand Up @@ -1236,6 +1239,9 @@ public Builder idleTimeout(long idleTimeout) {
* @return a new LoadGenerator instance
*/
public LoadGenerator build() {
if (rateRampUpPeriod > 0 && resourceRate == 0) {
throw new IllegalArgumentException("invalid rate ramp-up greater than 0 with resource rate 0");
}
return new LoadGenerator(this);
}
}
Expand Down

0 comments on commit f7a99a3

Please sign in to comment.