core[patch]: Relax time constraints on rate limit test (#25071)

Try to keep the unit test fast, but also have it repeat more robustly
This commit is contained in:
Eugene Yurtsev 2024-08-05 17:04:22 -04:00 committed by GitHub
parent 427a04151c
commit 4bcd2aad6c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -84,7 +84,7 @@ def test_rate_limit_batch() -> None:
toc = time.time()
# Should be larger than check every n seconds since the token bucket starts
# with 0 tokens.
assert time_to_fill < toc - tic < time_to_fill + 0.01
assert time_to_fill < toc - tic < time_to_fill + 0.03
async def test_rate_limit_abatch() -> None:
@ -102,7 +102,7 @@ async def test_rate_limit_abatch() -> None:
toc = time.time()
# Should be larger than check every n seconds since the token bucket starts
# with 0 tokens.
assert time_to_fill < toc - tic < time_to_fill + 0.01
assert time_to_fill < toc - tic < time_to_fill + 0.03
def test_rate_limit_stream() -> None: