From 8fdc102c543d6ec485479f22cc0a481df82331d5 Mon Sep 17 00:00:00 2001 From: KeshavSoni2511 Date: Thu, 19 Sep 2024 12:15:48 +0000 Subject: [PATCH] fix for 687 --- RELEASE_NOTES.md | 1 + src/wq/tests/benchmark/driver.py | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 42800a70..5f48659c 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -14,6 +14,7 @@ - Fix to return id and type in place of entityId and entityType (#751) - Fixed failing test cases of test_geocoding.py (#755) - Mentioned service path isn't the same as Orion's (#758) +- Added QL's version endpoint rather than sleeping (#687) ### Important: Backward compatibility diff --git a/src/wq/tests/benchmark/driver.py b/src/wq/tests/benchmark/driver.py index c62dce9a..d65dbfac 100644 --- a/src/wq/tests/benchmark/driver.py +++ b/src/wq/tests/benchmark/driver.py @@ -7,6 +7,8 @@ from utils.tests.docker import dir_from_file_path, DockerCompose from wq.tests.benchmark.factory import new_row_count_sampler, DbType, \ new_work_q_size_sampler +from conftest import QL_BASE_URL +from reporter.tests.utils import wait_until MONITORING_DIR_NAME = '_monitoring' @@ -15,6 +17,15 @@ DB_TABLE_FQN = 'public.etroom' # mt.etroom when using Crate? +def _can_get_ql_version() -> bool: + version_url = f"{QL_BASE_URL}/version" + response = requests.get(version_url) + return response.status_code == 200 + +def wait_for_ql(): + wait_until(_can_get_ql_version) + + class TestScript: @staticmethod @@ -48,9 +59,7 @@ def _prep_monitoring_dir(self): def _start_docker_and_wait_for_services(self): self._docker.start() - sleep(10) - # TODO call QL's version endpoint rather than sleeping. - # If it's up, then Redis & DB backend are up to b/c of docker deps. + wait_for_ql() def _start_samplers(self): self._db_sampler = new_row_count_sampler(self._mon_dir,