From dd1b7b9d4e792542e8f88db3c169dfc2fc2023a3 Mon Sep 17 00:00:00 2001 From: debugtalk Date: Thu, 23 Dec 2021 09:38:07 +0800 Subject: [PATCH] fix: unittest --- README.md | 2 ++ internal/boomer/boomer.go | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index cf8e9345..97650ffe 100644 --- a/README.md +++ b/README.md @@ -185,6 +185,7 @@ func TestCaseDemo(t *testing.T) { "varFoo2": "${max($a, $b)}", // 12.3; eval with built-in function }), TestSteps: []hrp.IStep{ + hrp.NewStep("transaction 1 start").StartTransaction("tran1"), // start transaction hrp.NewStep("get with params"). WithVariables(map[string]interface{}{ // step level variables "n": 3, // inherit config level variables if not set in step level, a/varFoo1 @@ -202,6 +203,7 @@ func TestCaseDemo(t *testing.T) { AssertLengthEqual("body.args.foo1", 5, "check args foo1"). // validate response body with jmespath AssertLengthEqual("$varFoo1", 5, "check args foo1"). // assert with extracted variable from current step AssertEqual("body.args.foo2", "34.5", "check args foo2"), // notice: request params value will be converted to string + hrp.NewStep("transaction 1 end").EndTransaction("tran1"), // end transaction hrp.NewStep("post json data"). POST("/post"). WithBody(map[string]interface{}{ diff --git a/internal/boomer/boomer.go b/internal/boomer/boomer.go index 7bc83664..dc824dc2 100644 --- a/internal/boomer/boomer.go +++ b/internal/boomer/boomer.go @@ -41,7 +41,7 @@ func (b *Boomer) SetRateLimiter(maxRPS int64, requestIncreaseRate string) { maxRPS = math.MaxInt64 } log.Warn().Int64("maxRPS", maxRPS).Str("increaseRate", requestIncreaseRate).Msg("set ramp up rate limiter") - rateLimiter, err = NewRampUpRateLimiter(math.MaxInt64, requestIncreaseRate, time.Second) + rateLimiter, err = NewRampUpRateLimiter(maxRPS, requestIncreaseRate, time.Second) } else { if maxRPS > 0 { log.Warn().Int64("maxRPS", maxRPS).Msg("set stable rate limiter")