Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BT-4723: Query limits tests are failing due to uncaught ThrottlingError #158

Merged
merged 2 commits into from
Mar 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading