Skip to content

Commit ac076cf

Browse files
szachovyCopilot
andcommitted
Replace fixed wait in get_query_results() with polling loop
Remove the hard 45s sleep and replace with a polling loop (12 attempts x 15s = 180s max). The test now succeeds even when the Celery worker is slow to process the query during cold starts or memory pressure. Closes #58 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 0ab8ce7 commit ac076cf

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1616
* CI workflow to build and push service images to GitHub Container Registry on master merge. (#97)
1717
* Pull-first with local build fallback for container images during deployment. (#97)
1818

19+
### Fixed
20+
21+
* Replace fixed 45s wait in get_query_results() with polling loop (12×15s). (#58)
22+
1923
### Changed
2024

2125
* Completed [ARCHITECTURE.md](./docs/ARCHITECTURE.md) (#93)

tests/testsuite/roles/testing/files/functional_superset.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,6 @@ def run_query(self) -> float:
325325
raise ValueError(f"Could not find query details in {sqllab_run_query!r}")
326326

327327
def get_query_results(self, dttm_time_query_identifier: float) -> None:
328-
time.sleep(45) # state refreshing
329328
ts = int(dttm_time_query_identifier) - 5000
330329
command = f"""
331330
curl \
@@ -339,14 +338,14 @@ def get_query_results(self, dttm_time_query_identifier: float) -> None:
339338
--header 'Referer: https://{self.virtual_ip_address}' \
340339
--header '{self.api_csrf_header}'
341340
"""
342-
for _ in range(10):
341+
for _ in range(12):
342+
time.sleep(15)
343343
query_result = self.decode_command_output(
344344
self.run_command_on_the_container(command)
345345
)
346346
list_of_results = query_result.get("result")
347347
if isinstance(list_of_results, list) and len(list_of_results) > 0:
348348
break
349-
time.sleep(30)
350349
else:
351350
raise ValueError(f"Could not get non-empty results after retries from {query_result}")
352351
first_result = list_of_results[0]

0 commit comments

Comments
 (0)