From 8eed01e24ca781a16834fb60ba1f9e100f92870b Mon Sep 17 00:00:00 2001 From: Marek Schmidt Date: Fri, 29 Nov 2024 18:47:32 +0100 Subject: [PATCH] round computed rate in real-traffic-test --- test/performance/benchmarks/real-traffic-test/main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/performance/benchmarks/real-traffic-test/main.go b/test/performance/benchmarks/real-traffic-test/main.go index bad45b39494c..d4309b58406a 100644 --- a/test/performance/benchmarks/real-traffic-test/main.go +++ b/test/performance/benchmarks/real-traffic-test/main.go @@ -21,6 +21,7 @@ import ( "flag" "fmt" "log" + "math" "math/rand" "net/http" "os" @@ -298,7 +299,7 @@ func checkSLA(results *vegeta.Metrics, rate vegeta.ConstantPacer) error { } // SLA 2: making sure the defined vegeta rates is met - if results.Rate == rate.Rate(time.Second) { + if math.Round(results.Rate) == rate.Rate(time.Second) { log.Printf("SLA 2 passed. vegeta rate is %f", rate.Rate(time.Second)) } else { return fmt.Errorf("SLA 2 failed. vegeta rate is %f, expected Rate is %f", results.Rate, rate.Rate(time.Second))