Skip to content

Commit

Permalink
BT-4723: Query limits tests are failing due to uncaught ThrottlingErr…
Browse files Browse the repository at this point in the history
…or (#158)
  • Loading branch information
adambollen authored Mar 5, 2024
1 parent 836eefd commit f6d5f23
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tests/integration/test_client_with_query_limits.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@
from fauna import fql
from fauna.client import Client
from fauna.encoding import QuerySuccess
from fauna.errors.errors import ThrottlingError


def query_collection(client: Client) -> QuerySuccess:
coll_name = os.environ.get("QUERY_LIMITS_COLL") or ""
return client.query(fql("${coll}.all().paginate(50)", coll=fql(coll_name)))
try:
return client.query(fql("${coll}.all().paginate(50)", coll=fql(coll_name)))
# Ignore ThrottlingErrors - just means retries were exhausted
except ThrottlingError:
return None


@pytest.mark.skipif(
Expand All @@ -36,8 +41,9 @@ def test_client_retries_throttled_query():
with ThreadPool() as pool:
results = pool.map(query_collection, clients)

# Expect at least one client to have succeeded on retry
for result in results:
if result.stats.attempts > 1:
if result is not None and result.stats.attempts > 1:
throttled = True

assert throttled == True
Expand Down

0 comments on commit f6d5f23

Please sign in to comment.