Skip to content

test: retry list_query_runs briefly in query_async_polling - #184

Open
eddietejeda wants to merge 1 commit into
mainfrom
test/deflake-query-run-listing
Open

test: retry list_query_runs briefly in query_async_polling#184
eddietejeda wants to merge 1 commit into
mainfrom
test/deflake-query-run-listing

Conversation

@eddietejeda

Copy link
Copy Markdown
Contributor

Deflakes test_query_async_polling: main run 33699871288 failed because the just-succeeded query run wasn't in list_query_runs yet — three CI runs had landed on main within 12 seconds and share the sdkci-shared database. The run itself succeeded; only the immediate listing assertion raced. Retry the listing for up to 10s before failing.

The shared sdkci database serves concurrent CI runs, and a run that just
reached terminal status can lag out of list_query_runs momentarily —
seen on main run 33699871288, where the run succeeded but the immediate
listing missed it while two sibling CI runs were active. Poll for up to
10s before declaring the run missing.
@eddietejeda
eddietejeda requested a review from a team as a code owner September 3, 2026 00:37
@eddietejeda
eddietejeda requested review from rohan-hotdata and removed request for a team September 3, 2026 00:37
assert time.monotonic() < listing_deadline, (
f"query run {query_run_id} not surfaced by list_query_runs"
)
time.sleep(POLL_INTERVAL_S)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: the list_results assertion at line 99 has the same race (not blocking).

list_results runs against the same shared sdkci-shared database, immediately after the result is created. A result that just became visible can lag out of the listing exactly like a query run does. That assertion still fails on the first miss, so test_query_async_polling can flake again at line 99 for the same reason.

Wrap the list_results call in the same bounded retry, or factor the retry into a small local helper that both listings call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant