Skip to content

Commit

Permalink
test(flaky): Fixes flaky rate limit test (#3684)
Browse files Browse the repository at this point in the history
Two different attempts of making the test non-flaky colliding made it
even worse. This should fix it for good.
  • Loading branch information
Dav1dde authored Jun 4, 2024
1 parent a70157b commit 36e7b58
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/integration/test_outcome.py
Original file line number Diff line number Diff line change
Expand Up @@ -1984,7 +1984,7 @@ def test_global_rate_limit_by_namespace(
"scope": "global",
"categories": ["metric_bucket"],
"limit": metric_bucket_limit,
"window": int(datetime.now(UTC).timestamp()),
"window": int(datetime.now(UTC).timestamp()) - 1,
"reasonCode": global_reason_code,
},
{
Expand All @@ -1993,13 +1993,13 @@ def test_global_rate_limit_by_namespace(
"categories": ["metric_bucket"],
"limit": transaction_limit,
"namespace": "transactions",
"window": int(datetime.now(UTC).timestamp()),
"window": int(datetime.now(UTC).timestamp()) - 1,
"reasonCode": transaction_reason_code,
},
]

# Truncate the timestamp and add a slight offset to never be on the border of the rate limiting window.
ts = datetime.now(UTC).timestamp() // 100 * 100 + 50
ts = datetime.now(UTC).timestamp()

def send_buckets(n, name, value, ty):
for i in range(n):
Expand Down

0 comments on commit 36e7b58

Please sign in to comment.