Skip to content

Commit

Permalink
refactor(ratelimit_test.go): simplify calculation of lower limit in test
Browse files Browse the repository at this point in the history
fix(ratelimit_test.go): fix calculation of upper limit in test
  • Loading branch information
chronark committed Sep 20, 2024
1 parent 29d67ee commit 8f97d37
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions apps/agent/services/ratelimit/ratelimit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,12 @@ func TestAccuracy_fixed_time(t *testing.T) {
}
}

exactLimit := limit * (windows + 1)
lower := exactLimit
lower := limit * windows
// At most 150% + 75% per additional ingress node should pass
upper := 1.50 + 1.0*float64(len(ingressNodes)-1)

require.GreaterOrEqual(t, passed, lower)
require.LessOrEqual(t, passed, int64(float64(exactLimit)*upper))
require.LessOrEqual(t, passed, int64(float64(limit*(windows+1))*upper))

})
}
Expand Down

0 comments on commit 8f97d37

Please sign in to comment.